Webpack react individually packaged CSS
Webpack require CSS method, the default will be the CSS into the JS file, loading sequence is problematic, if you need to play a separate CSS file
Operation Steps: Step1:
Installing the Webpack plugin plugin
npm install extract-text-webpack-plugin --save
Step2:
Modifying the Webpack.config.js configuration
Reference Plugin
var ExtractTextPlugin = require("extract-text-webpack-plugin");
In the module of config:
{test:/\.less$/, Loader:ExtractTextPlugin.extract ("Style-loader", "Css-loader", "Less-loader")},
Last plugins add
Problem
Q:Module build failed: ReferenceError: window is not defined.
A: Modify Loader
error demonstration: loader:extracttextplugin.extract ("Style-loader!css-loader!less-loader")
Correct demonstration:loader: ExtractTextPlugin.extract("style-loader", "css-loader","less-loader")
Reference article:
1. https://webpack.github.io/docs/stylesheets.html
2. Http://stackoverflow.com/questions/28223040/window-not-defined-error-when-using-extract-text-webpack-plugin-react
Webpack react individually packaged CSS