1

webpack-dev-server 実行中のエラー

ERROR in ./css/app.scss
Module build failed: Error: Parameter 'dependency' must be a Dependency
    at Compilation.process [as _addModuleChain] (/usr/local/lib/node_modules/webpack-dev-server/node_modules/webpack/lib/Compilation.js:347:9)
    at Compilation.process [as addEntry] (/usr/local/lib/node_modules/webpack-dev-server/node_modules/webpack/lib/Compilation.js:423:7)
    at SingleEntryPlugin.<anonymous> (/Users/roshankarki/Desktop/del_del/wp_tst/node_modules/webpack/lib/SingleEntryPlugin.js:22:15)
    at Compiler.applyPluginsParallel (/usr/local/lib/node_modules/webpack-dev-server/node_modules/webpack/node_modules/tapable/lib/Tapable.js:107:14)
    at Compiler.compile (/usr/local/lib/node_modules/webpack-dev-server/node_modules/webpack/lib/Compiler.js:394:7)
    at Compiler.runAsChild (/usr/local/lib/node_modules/webpack-dev-server/node_modules/webpack/lib/Compiler.js:203:7)
    at Object.module.exports.pitch (/Users/roshankarki/Desktop/del_del/wp_tst/node_modules/extract-text-webpack-plugin/loader.js:81:18)
webpack: bundle is now VALID.

私の webpack.config.js は次のようになります。

var path = require('path');
var ExtractTextPlugin = require("extract-text-webpack-plugin");

module.exports = {
    /* this defins path where entry files are to be found */
    context: path.resolve('js'),
    entry: ["./utils","./app"], 
    output: {
        /* this is output directory of bundle.js */
        path: path.resolve('build/'),
        /* this is path of directory where bundle will be served in server */
        publicPath: '/public/assets/',
        filename: "bundle.js"
    },

    /* this plugin helps to generate seperate styles.css file rather in once single bundle.js file */
    plugins: [
        new ExtractTextPlugin("styles.css")
    ],

    /* when server is loaded it tells where to look for index file accessed from root */
    devServer: {
        contentBase: 'public'
    },

    module: {
        preLoaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "jshint-loader"
            }
        ],
        loaders: [
            {
                test: /\.es6$/, 
                exclude: /node_modules/, 
                loader: "babel-loader"
            },
            {
                test: /\.css$/, 
                exclude: /node_modules/ ,
                loader: ExtractTextPlugin.extract("style-loader", "css-loader")
            },
            {
                test: /\.scss$/, 
                exclude: /node_modules/ ,
                loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")
            }
        ]
    }, 


    /* this will resolve file in common js style require without extension */
    resolve: {
        extensions: ['', '.js', '.es6']
    },

    watch: true

}

このプラグインを使用する前は、すべて正常に機能していました。css の別のバンドルを出力するつもりなので、この問題を修正する必要があります。

github で問題が見つかりましたが、役に立ちませんでした:

https://github.com/webpack/extract-text-webpack-plugin/issues/132
4

1 に答える 1