seek-oss/css-modules-typescript-loader

Don't create typings files for non-named imports

fourpastmidnight opened this issue · 0 comments

I'm using Semantic UI React along with their Semantic UI CSS styles.

App.tsx:

import 'semantic-ui-css/semantic.min.css';
import './App.css'
import MyComponent from './components';

export const App = () => <MyComponent />

export default App;

In the code above, both CSS imports cause a <filename>.css.d.ts file to be created. But this is problematic for the semantic.min.css file because it's not my file. It's one provided by a NPM library. And I'm using a mono-repo with Yarn and PnPJS, so there is no node_modules folder, but a cache of ZIP files with a require.resolve hook/interceptor to provide module resolution for node--i.e. the "node_modules" filesystem is "read-only". And so this loader fails:

D:/src/git/my-project/.yarn/cache/semantic-ui-css-npm-2.4.1-488d289b03-51eb2d50e7.zip/node_modules/semantic-ui-css/semantic.min.css (D:/src/git/my-project/.yarn/$$virtual/css-loader-virtual-73afbc880bb/0/cache/css-loader-npm-4.3.0-33464197c9-1f441ac567.zip/node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!D:/src/git/my-project/.yarn/cache/css-modules-typescript-loader-npm-4.0.1-393a7cad32-5af2583d4a.zip/node_modules/css-modules-typescript-loader!D:/src/git/my-project/.yarn/cache/postcss-loader-npm-3.0.0-f4ab99b685-50b2d8892d.zip/node_modules/postcss-loader/src?postcss!D:/src/git/my-project/.yarn/cache/semantic-ui-css-npm-2.4.1-488d289b03-51e2d50e7.zip/node_modules/semantic-ui-css/semantic.min.css)
Error: EROFS: read-only filesystem, open '/node_modules/semantic-ui-css-semantic.min.css.d.ts'