gajus / write-file-webpack-plugin

Forces webpack-dev-server to write bundle files to the file system.
Other
527 stars 54 forks source link

Plugin is not working with new new web dev server #73

Open jmesa-sistel opened 5 years ago

jmesa-sistel commented 5 years ago

Due to this commit add output.futureEmitAssets your plugin is not working anymore on new web dev server. Do you have a workaround?

Edit: I found the work around:

module.exports = {
    output: {
         ......  
        futureEmitAssets: false   // https://github.com/webpack/webpack/pull/8642/files due this change in webpack, writeFilePlugin is not working, we have to disable that option. This will not work on webpack 5
    },
rodries commented 5 years ago

@gajus do you know how to fix the plugin if futureEmitAssets is true ?

gajus commented 5 years ago

I do not. PR is welcome.

rodries commented 5 years ago

I've notice that they have the same problem. Webpack implemented writeToDisk in web dev server and it's not working also, you will have the same error, I guess they will have to fix it, so you can copy the solution, but I guess they will remove that option, as you can read in comment (problem in webpack with writeToDisk ) writetodisk info

fraziermork commented 4 years ago

Any updates on this?

It seems like anything that reads the asset after it's been emitted will throw based on this: https://github.com/webpack/webpack/pull/8642

It seems like HandleAfterEmit is the most likely culprit? Can any of that work be done before emitting instead?

gajus commented 4 years ago

Anyone is welcome to contribute a solution.

jmesa-sistel commented 4 years ago

@gajus At now there is a workaround. I have posted it in first post: module.exports.output.futureEmitAssets = false; In webpack 5 they have removed this variable // TODO webpack 5 remove futureEmitAssets option and make it on by default

tarkant commented 1 year ago

Hello, after upgrading from webpack 4.41.5 to webpack 5.75.0 I started having this issue. As I need webpack to emit the dist files even if it's in dev mode I dug through some threads and documentation and came across the following:

I've added to my development configuration the mentioned option and it works as expected :

module.exports = {
  // your other options

  optimization: {
   // Your optimization options
  },

  plugins: [
    // your plugins
  ],
  devServer: {
    devMiddleware: {
      writeToDisk: true, // <= what you need to add
    },
  },
};

Hope this helps.