Build css modules using webpack in prod build#17
Conversation
|
Hi @sag1v - Sorry, yes, I agree this is just a starting point, not a finished example. I'm going to work on a full working solution, but it will be a few days before I complete it. Thanks for your patience! :) |
|
@coryhouse Thank you so much for doing this! |
Seems legit. Are we good to go? 🙏 😄 |
| "predeploy:docs": "npm run build:docs", | ||
| "deploy:docs": "gh-pages -d build", | ||
| "build:commonjs": "cross-env NODE_ENV=production babel ./src/components --out-dir ./lib --ignore spec.js", | ||
| "build:commonjs": "cross-env NODE_ENV=production webpack --config config/webpack.config.prod.js", |
There was a problem hiding this comment.
Are you sure webpack can keep the folder structure of the components for both the js and css files?
|
Hi Sagiv - Sorry, I'm busy traveling out of the country for consulting and committed this as work in progress just to back it up. It's not complete. Not sure when I'll get it done since consulting work is very busy right now, but I think this commit is in the right direction. |

This is a quick example of using webpack to compile CSS Modules for production. Not perfect, since this also processes the JS, which we're already handling separately via the
build:commonjsscript, but you can throw the JS processed by Webpack away.