简体   繁体   中英

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM