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

output.futureEmitAssets option breaks compatibility with source map upload plugins #8883

Closed
bengourley opened this issue Mar 8, 2019 · 2 comments

Comments

@bengourley
Copy link

Bug report

The output.futureEmitAssets option added in v4.29 breaks BugsnagSourceMapUploaderPlugin (specific Webpack version tested: 4.29.6).

Full disclosure, I am the maintainer of webpack-bugsnag-plugins.

Related issues

bugsnag/webpack-bugsnag-plugins#28
honeybadger-io/honeybadger-webpack#85
thredup/rollbar-sourcemap-webpack-plugin#61

Current behaviour

The source map uploader implements an afterEmit plugin which makes use of source.existsAt to find the location of the output files and their accompanying source maps. When the new option output.futureEmitAssets is switched on (which I understand is to be the new default), the sources in the afterEmit hook no longer have the existsAt property. This property does not exist on the sources in the emit stage either, presumably because the files are not yet written to disk, but I assume the compiler must know where the files will end up being written?

Steps to reproduce

Add BugsnagSourceMapUploader to any Webpack project using >=4.29 and enable output.futureEmitAssets. Or check out this repro.

Expected behaviour

At some stage around emit/afterEmit I would expect there to be information on where a file exists on disk, so that the BugsnagSourceMapUploaderPlugin can retrieve it. Prior to v4.29 this was the case, but subsequently it does not.

Other relevant information:
webpack version: 4.29.x
Node.js version: any compatible
Operating System: any
Additional tools: webpack-bugsnag-plugins

@sokra
Copy link
Member

sokra commented Mar 12, 2019

You don't need existsAt. Join filename and output path to get the full path.

webpack/lib/Compiler.js

Lines 333 to 336 in 685a062

const targetPath = this.outputFileSystem.join(
outputPath,
targetFile
);

outputPath = compilation.getPath(this.outputPath);

@bengourley
Copy link
Author

Thanks! Switching to that kind of implementation worked for us. For anybody else interested here's the change we made: bugsnag/webpack-bugsnag-plugins#29.

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

No branches or pull requests

2 participants