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

Support Webpack 4.29.0 breaking change #74

Closed
Jack-Works opened this issue Apr 23, 2019 · 8 comments
Closed

Support Webpack 4.29.0 breaking change #74

Jack-Works opened this issue Apr 23, 2019 · 8 comments

Comments

@Jack-Works
Copy link

Jack-Works commented Apr 23, 2019

// asset.size method returns `undefined` for binary files (e.g. WASM). This is a temporarily workaround.

If asset is an instance of SizeOnlySource, it will throw an error on any method except size

Breaking change: https://github.com/webpack/webpack/releases/tag/v4.29.0

  • add output.futureEmitAssets which gives the emitting logic of webpack 5
    • assets are replaced with SizeOnlySources
    • reading assets after emitting is no longer allowed
    • This allows memory to be garbage-collected

Exception stack

Error: Content and Map of this Source is no longer available (only size() is supported)
    at SizeOnlySource._error (node_modules/webpack/lib/Compiler.js:647:10)
    at SizeOnlySource.source (node_modules/webpack/lib/Compiler.js:661:14)
    at getAssetSource (node_modules/write-file-webpack-plugin/dist/WriteFileWebpackPlugin.js:116:24)
    at node_modules/write-file-webpack-plugin/dist/WriteFileWebpackPlugin.js:201:27
    at node_modules/lodash/lodash.js:4911:15
    at baseForOwn (node_modules/lodash/lodash.js:2996:24)
    at node_modules/lodash/lodash.js:4880:18
    at Function.forEach (node_modules/lodash/lodash.js:9344:14)
    at handleAfterEmit (node_modules/write-file-webpack-plugin/dist/WriteFileWebpackPlugin.js:182:24)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:32:10), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
    at asyncLib.forEachLimit.err (node_modules/webpack/lib/Compiler.js:432:27)
    at node_modules/neo-async/async.js:2813:7
    at done (node_modules/neo-async/async.js:3521:9)
    at outputFileSystem.writeFile.err (node_modules/webpack/lib/Compiler.js:400:9)
    at MemoryFileSystem.writeFile (node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
@Jack-Works Jack-Works changed the title Exception: Support Webpack 5 breaking change Apr 23, 2019
@Jack-Works Jack-Works changed the title Support Webpack 5 breaking change Support Webpack 4.29.0 breaking change Apr 23, 2019
@Jack-Works
Copy link
Author

Jack-Works commented Apr 23, 2019

Workaround:
Set config.output.futureEmitAssets = false

But this behavior will be default in webpack 5

@gajus gajus closed this as completed Apr 23, 2019
@Jack-Works
Copy link
Author

Hold on! This doesn't get fixed!

Webpack will switch to this new behavior and we don't know if they will give us an option to fall back to the old behavior!!

@gajus gajus reopened this Apr 23, 2019
@feorex
Copy link

feorex commented May 1, 2019

@Jack-Works Correct path is:
config.output.futureEmitAssets=false

@septs
Copy link

septs commented Aug 9, 2019

// TODO webpack 5 remove futureEmitAssets option and make it on by default

https://github.com/webpack/webpack/blob/40755384bfe9725e3105e7b5f9becba2c43f2a5f/lib/Compiler.js#L374

Copy @gajus @feorex @Jack-Works

@kievsash
Copy link

In Angular cli 8.3 I got this error for ng build --prod

But ng build --prod --source-map=false worked for me

@lukeapage
Copy link

Note - this is removed in webpack 5 beta, so this plugin does not work in webpack 5.

@KevinGhadyani-minted
Copy link

I'm on Webpack 5. This plugin is broken for me :/.

@idflood
Copy link
Contributor

idflood commented Sep 25, 2020

It seems that this plugin is not needed anymore with webpack 5 (edit: since webpack-dev-server 3.1.10) 🎉

The webpack-dev-server now has a writeToDisk option and the same is available too with webpack-dev-middleware.

The middleware page even have this description:

If true, the option will instruct the module to write files to the configured location on disk as specified in your webpack config file. Setting writeToDisk: true won't change the behavior of the webpack-dev-middleware, and bundle files accessed through the browser will still be served from memory. This option provides the same capabilities as the WriteFilePlugin.

So thanks a lot @gajus for this excellent plugin, even if it's not needed anymore it will still be used for years to come in already existing projects :)

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

8 participants