webpack 2“webpack-dev-server”

时间:2017-05-13 14:10:53

标签: javascript webpack-dev-server webpack-2 webpack-style-loader

我是webpack 2的新手,我的问题是当我运行webpack-server(http://localhost:8080/)时,webpack没有在正确的页面中重定向我而且我的css也没有工作。 我得到这个页面:enter image description here

我的webpack.config.js:

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


module.exports = {
    entry : './src/app.js',
    output : {
        path : path.resolve(__dirname,'dist/'),
        filename : 'app.bundle.js'
    },
    module : {
        rules : [
            //{test: /\.css$/, use: ExtractTextPlugin.extract(['style-loader','css-loader'])},
            {test: /\.scss$/, 
            loader: ExtractTextPlugin.extract({
                fallback: "style-loader",
                use: ['css-loader','sass-loader'],
                publicPath: "/dist"
            })}
        ]
    },
    plugins: [
        new ExtractTextPlugin({
            filename: "/dist/app.scss",
            disable: false,
            allChunks: true
        })
    ]
}
谢谢你!

0 个答案:

没有答案