use plug-in extract-text-webpack-plugin:
package this error after running webpack:
/ Users/apple/work/self_test/webpack/node_modules/schema-utils/dist/validateOptions.js:40
throw new _ValidationError2.default(ajv.errors, name);
^
false
webpack.config,js
//1. webpack
const webpack = require("webpack");
const path = require("path");
// css---
const ExtractTextPlugin = require("extract-text-webpack-plugin")
//2.webpack ,
const commonsPlugin = new webpack.optimize.CommonsChunkPlugin("common.js");
const extractCssPlugin = new ExtractTextPlugin({
filename:path.resolve(__dirname, "dist/css/[name].css"),
disabled:process.env.NODE_ENV === "deverlopment"
})
//
module.exports = {
//3.---
plugins: [
commonsPlugin,
extractCssPlugin
],
//4.---
entry: {
test1 : "./js/page1/ab_entry.js",
test2 : "./js/page2/ey_entry.js",
},
//5.
output: {
path: path.resolve(__dirname, "dist/js"),
filename: "[name].js"
}
,
//6.---- webpack
module: {
//npm install XXXnode_module
rules: [
{ test: /\.css$/,
use:ExtractTextPlugin.extract({
// use style-loader in deverlopment
fallback: "style-loader",
use:["css-loader","sass-loader","postcss-loader"]
// use:[{loader:"css-loader"},{loader:"sass-loader"},{loader:"postcss-loader"}]
}),
}]
},
//7.
resolve: {
root: "E:/github/flux-example/src", //
extensions: ["", ".js", ".json", ".scss"],//require
alias: {//
AppStore : "js/stores/AppStores.js",// require("AppStore")
ActionType : "js/actions/ActionType.js",
AppAction : "js/actions/AppAction.js"
}
}
};