Webpack css loading
See original GitHub issueEnvironment(required)
- antd version: 2.7.4
- OS and its version: Xubuntu 16.04
- Browser and its version: Chromium 55.0.2883.87
What did you do? Please provide steps to re-produce your problem.
Just importing a antd component. Using babel-plugin-import 1.1.1 with:
["import", {
"libraryName": "antd",
style: 'css'
}]
I use webpack 2 with a css loader as:
test: /\.s?css$/,
exclude: /node_modules/,
loaders: ["style-loader", "css-loader?sourceMap", "postcss-loader", "sass-loader?sourceMap&sourceComments"]
If I don’t include style: 'css'
in babel import, webpack compiles, but ant styles are not loaded in my web application.
What do you expected?
Webpack compile with no problem. Styles are loaded
What happen?
ERROR in ./~/antd/lib/button/style/index.css
Module parse failed: /home/guillaume/Projects/bender-front-new/node_modules/antd/lib/button/style/index.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (6 by maintainers)
Top Results From Across the Web
css-loader | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >How to configure CSS and CSS modules in webpack
To be able to use CSS in your webpack app, you need to set up a new loader. Out-of-the-box, webpack only understands Javascript...
Read more >How to configure CSS Modules for webpack - LogRocket Blog
Increase the flexibility of your app's CSS components with CSS Modules and Webpack in this handy tutorial and demo app build.
Read more >How to CSS with Webpack 5 - Setup Tutorial
CSS with Webpack in Production ... If you happen to have a Webpack configuration for development and production, you will need a different ......
Read more >How to import CSS files into webpack? - Stack Overflow
You have to import them like any JavaScript module. That means, when the imported file is neither a relative path (starting with ../...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue is resolved for me when i remove part of the recommended .babelrc config for ant-design
Before:
After:
webpack 3.6 antd 3.2.1
Just don’t exclude
node_modules/antd
.