Skip to content

Does not copy files to actual output folder when webpack-dev-server is used #29

@afilp

Description

@afilp

It appears that nothing happens when trying to copy some extra files (not bundled) to the output folder, under the webpack-dev-server logic:

devServer: {
            contentBase: './public',
            outputPath: path.resolve(ROOT_PATH, 'public'),
            historyApiFallback: true,
            hot: true,
            inline: true,
            port: 33000,
            progress: true
        },
        plugins: [
            new CopyWebpackPlugin([
                {from: 'src/css', to: 'css', force: true},
                {from: 'src/img', to: 'img', force: true}
            ]),
            new webpack.HotModuleReplacementPlugin(),
            new OpenBrowserPlugin({url: 'http://localhost:33000'})
        ]

Can this be done somehow? The webpack-dev-server needs this to show some external CSS and IMAGE files. I used to be doing this with gulp but now I want to get rid of this dependency.

Using your plugin with the simple webpack (for build) works perfectly but not for webpack-dev-server.

NOTE: I can achieve what I want if I use both webpack and webpack-dev-server on the start script, but this is not too elegant and done only for solving this problem:

  "scripts": {
    "build": "webpack",
    "start": "npm run build && webpack-dev-server"
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions