Comments (2)
Sorry, no way we can support this from our side. The issue is with CRA.
from css-modules-typescript-loader.
Use craco? Follow the directions at craco to set it up for use with your project. Then all you need to do is add the following in the craco.config.js
file:
const { addAfterLoader, loaderByName, throwUnexpectedConfigError } = require('@craco/craco');
const throwError = message =>
throwUnexpectedConfigError({
packageName: 'craco',
githubRepo: 'gsoft-inc/craco',
message,
githubIssueQuery: 'webpack'
});
module.exports = {
webpack: {
configure: (webpackConfig) => {
console.log('Adding css-modules-typescript-loader...');
const cssModulesTypeScriptLoader = {
loader: require.resolve('css-modules-typescript-loader')
};
const { isAdded } = addAfterLoader(webpackConfig, loaderByName('css-loader'), cssModulesTypeScriptLoader);
if (!isAdded) {
throwError('Failed to add the css-modules-typescript-loader!')
}
return webpackConfig;
}
}
};
The only issue I'm currently running into is that I'm using a mono-repo with Yarn and PnP and this module seems to be trying to overwrite *.css.d.ts files in the PnP cache, which are really Zip files and so are read-only, causing an error. I'm trying to understand if there's a way to have this loader exclude those files or restrict what it attempts to create a typings file for.
In my project, I'm using Semantic UI React, and in the main App.tsx
file, I'm using import 'semantic-ui-css/semantic.min.css'
. This CSS file is offered as a npm library. And because it's imported, this webpack loader is attempting to create a typings flise for it. I really don't want it to.
First, I'm not doing something like import semanticUIStyles from 'semantic-ui-css/semantic.min.css'
, where then I could use semanticUIStyles
in my react components to access discrete style classes. I'm simply importing the CSS file so that CSS styles are applied to the elements.
from css-modules-typescript-loader.
Related Issues (20)
- Mode 'verify' and tests do not run on Windows HOT 3
- declare const instead of var
- CSS Selectors using hyphens aren't compile-time checked due to square bracket access HOT 5
- Question: use generated TypeScript declaration in my React component. HOT 2
- Compatibility with modular-css
- Empty css.d.ts file HOT 2
- Cannot access directly the style from style object HOT 6
- Format output using Prettier
- style-loader docs is missing
- exporting of const=cssExports is redundant
- Support named exports
- Doesn't export fields with css-loader ^4.0.0 HOT 7
- npm file inclusion
- Cannot find module './Component.module.scss' and unused components
- Don't create typings files for non-named imports
- Definition file generated different in development compared to production mode
- Is it recommended to commit generated *.scss.d.ts files? HOT 1
- Generate app.d.css.ts instead of app.css.d.ts
- Not working with css-loader 7.1.2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-modules-typescript-loader.