webpack开发服务器“不是从webpack提供内容”

时间:2018-12-19 08:11:59

标签: webpack webpack-dev-server

嗨?我安装了webpack开发服务器,并收到类似“我不是要从/提供webpack的内容”这样的错误,我想修复它!

帮助!

-webapck.dev.config.js 脚本:“ webpack-dev”:“ webpack-dev-server --config webpack.dev.config.js --progress --mode development”,

const path = require('path')
const webpack = require('webpack')
module.exports = {
    entry: './src/index.js',
    output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
        publicPath: "/"
    },
    devServer: {
      port: 9000,
      hot: true,
      contentBase: './dist',
      watchContentBase: true,
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                use: [{
                    loader: 'babel-loader',
                    options: {
                        presets: [
                            [
                                '@babel/preset-env', {
                                targets: {node: 'current'}, // 노드일 경우만
                                modules: 'false'
                            }
                            ],
                        ],
                    },
                }],
                exclude: ['/node_modules', '/bower_components'],
            },
            ],
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin()
    ],
    optimization: {},
}

0 个答案:

没有答案