Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jmesa-sistel opened this issue Feb 5, 2019 · 7 comments
Open

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

jmesa-sistel opened this issue Feb 5, 2019 · 7 comments

Comments

@jmesa-sistel
Copy link

jmesa-sistel commented Feb 5, 2019

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
Copy link

rodries commented Feb 6, 2019

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

@gajus
Copy link
Owner

gajus commented Feb 6, 2019

I do not. PR is welcome.

@rodries
Copy link

rodries commented Feb 6, 2019

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
Copy link

Any updates on this?

It seems like anything that reads the asset after it's been emitted will throw based on this: webpack/webpack#8642

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

@gajus
Copy link
Owner

gajus commented Jun 15, 2020

Anyone is welcome to contribute a solution.

@jmesa-sistel
Copy link
Author

jmesa-sistel commented Jun 16, 2020

@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
Copy link

tarkant commented Dec 14, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants