Home > Blockchain >  How to use CSS modules in a React based Wordpress plugin?
How to use CSS modules in a React based Wordpress plugin?

Time:01-13

I have this line in one of my tsx file:

import styles from "../../styles/buyTicket.module.css";

got this error:

ERROR in /Applications/MAMP/htdocs/wp-content/plugins/tikex/tikexModule/components/BuyTicket/PricingOptionInvoiceItemsFormFieldsCheckboxes.tsx
./tikexModule/components/BuyTicket/PricingOptionInvoiceItemsFormFieldsCheckboxes.tsx 7:19-54
[tsl] ERROR in /Applications/MAMP/htdocs/wp-content/plugins/tikex/tikexModule/components/BuyTicket/PricingOptionInvoiceItemsFormFieldsCheckboxes.tsx(7,20)
      TS2307: Cannot find module '../../styles/buyTicket.module.css' or its corresponding type declarations.

If I remove styles then I got this error no more, but then it will work not as a CSS module, and naming collosion will happen. What would you suggest?

CodePudding user response:

As far as i can understand, you may have a look here:
Can't import CSS/SCSS modules. TypeScript says "Cannot Find Module"

and here:
React, Typescript - Cannot find module ... or its corresponding type declarations

  •  Tags:  
  • Related