node.js - webpack的 extract text plugin for webpack 报错怎么回事?
PHPz
PHPz 2017-04-17 13:52:41
[Node.js讨论组]

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

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

学习是最好的投资!

全部回复(4)
阿神

你看下你的node_modules下有没有webpack/lib/removeAndDo.js这个文件

没有的话,就npm install 或者直接把node_modules下全部删除,然后重新安装一下试试

高洛峰

你需要参考一下 webpack 的 travis 配置,之前是需要强行 npm link webpack 的,但现在使用yarn就不用了

大家讲道理
npm remove webpack -g
npm i webpack -D
ringa_lee

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里有

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号