Poimen / stencil-tailwind-plugin

Plugin for using tailwindcss with StencilJS
https://www.npmjs.com/package/stencil-tailwind-plugin
MIT License
51 stars 5 forks source link

CSS file check is too broad #31

Closed timsnadden closed 1 year ago

timsnadden commented 1 year ago

Importing javascript files that include .css in the middle of the file name (e.g. my-file.css.js) leads to a rollup error:

Rollup: Plugin Error
           Cannot read properties of undefined (reading 'text') (plugin: tailwind, transform)

The package that triggered this error for me is @spectrum-web-components/overlay. So this can be reproduced by adding this package to a project and importing it into a stencil component as follows:

import { Overlay } from '@spectrum-web-components/overlay';

The useStyleSheetTransform check is too loose so javascript ends up being treated as CSS

Poimen commented 1 year ago

This should now be fixed in v1.8.0

Remedy: The fix to use path to get the extension then match on .css/.scss/.sass