node.js - webpack的 extract text plugin for webpack 报错怎么回事?
PHPz
PHPz 2017-04-17 13:52:41
0
4
647

官方的例子,都跑不起来?

const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
    entry: "./src/js/app.js",
    output: {
        path: __dirname,
        filename: "bundle.js"
    },
    module: {
        loaders: [
            { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
            { test: /\.styl$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader","stylus-loader") },
            { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }
        ]
    },
    plugins: [
        new ExtractTextPlugin("styles.css")
    ]
};

错误信息:

PHPz
PHPz

学习是最好的投资!

reply all(4)
阿神

Check if there is webpack/lib/removeAndDo.js file under your node_modules

If not, just npm install or just delete all node_modules and try reinstalling it

小葫芦

You need to refer to the travis configuration of webpack. Before, you needed to force npm link webpack, but now you don’t need to use yarn

大家讲道理
npm remove webpack -g
npm i webpack -D
左手右手慢动作

Run npm install in the root of the project.
Run npm link webpack in the root of the project.
Run node build.js in the specific example directory. (Ex: cd examples/commonjs && node build.js)

example下的README里有

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template