webpack-dev-server not creating dist folder on local

syqv5f0l  于 12个月前  发布在  Webpack
关注(0)|答案(2)|浏览(148)

webpack-dev-server成功绑定了html、scss和js文件,输出也在localhost:8080上提供,但dist文件夹没有在本地创建。以下是我的webpack配置:

var extractPlugin = new ExtractTextPlugin({
   filename: 'main.css'
});

module.exports = {
    entry: './src/index.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
    },
    devtool: 'inline-source-map',
    devServer: {
      port: 3000
    },
    plugins: [
        extractPlugin,
        new HtmlWebpackPlugin({
            template: 'public/index.html'
        }),
        new CleanWebpackPlugin(['dist'])
    ]
};

字符串

hkmswyz6

hkmswyz61#

webpack-dev-server从内存中提供创建的bundle,而不将其写入dist目录。

2exbekwf

2exbekwf2#

--watch添加到npm脚本中解决了这个问题。

{
  ...
  "scripts": {
    "dev": "webpack --mode development --watch",
    ...
  }
}

字符串

相关问题