Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

webpack-dev-server not creating dist folder on local

The webpack-dev-server is bundling the html, scss and js files successfully and the output is also getting served on localhost:8080 but the dist folder is not getting created on local. Following is my webpack configuration:

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'])
    ]
};
like image 828
m-ketan Avatar asked Aug 04 '17 06:08

m-ketan


People also ask

Does webpack create a dist folder?

Webpack will generate the files and put them in the /dist folder for you, but it doesn't keep track of which files are actually in use by your project. In general it's good practice to clean the /dist folder before each build, so that only used files will be generated.

Where does webpack-dev-server serve files from?

The webpack-dev-server will serve the files in the current directory, unless you configure a specific content base. Using this config webpack-dev-server will serve the static files in your public folder. It'll watch your source files for changes and when changes are made the bundle will be recompiled.


1 Answers

The webpack-dev-server serves the created bundle from memory and does not write it to the dist directory.

like image 94
Chris Baldwin Avatar answered Oct 30 '22 02:10

Chris Baldwin