Skip to content

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Sep 6, 2018

Fixes #408.

The fix itself is straightforward but adding a test was a bit more troublesome. I had to upgrade eslint and add babel-eslint so that the dynamic import() syntax would pass eslint. I also tweaked the harness a bit to log more details when things fail. The test only has a reference for webpack4 and is skpped on earlier webpack versions.

…in basic-with-wasm-module/main.js is accepted by eslint.

This also removes unnecessary path globbing from the eslint invocation
because it was failing on Windows with the new eslint version (not sure
why) - but it's not necessary anyway because eslint recurses by default
and only checks .js files by default.
This test uses the minimumWebpackMajorVersion flag so that we don't
attempt to compile with webpack 2 or 3 which don't understand wasm
modules.
@NekR
Copy link
Owner

NekR commented Sep 29, 2018

Hey. Sorry for a delay. This is great that you did this. But lib/ is generated folder. You need to modify files in src/ and then generate lib/ folder. See https://github.com/NekR/offline-plugin/blob/master/CONTRIBUTING.md for details.

@mstange
Copy link
Contributor Author

mstange commented Sep 29, 2018

The patch touches src/ too. If I recall correctly, I generated the change to lib/ the way you say (by building), but it's been a while and I don't 100% remember. I guess it's possible that I edited lib/index.js manually with the equivalent change. I can build again to make sure, if you'd like.

@mstange
Copy link
Contributor Author

mstange commented Sep 29, 2018

Thanks for taking a look!

@NekR
Copy link
Owner

NekR commented Oct 1, 2018

Oh, yeah, indeed, there are changes in src/ as well. My bad. I'll take a closer look at it soon 👌

@julienw
Copy link
Contributor

julienw commented Nov 22, 2018

hey @NekR, could you look at it ? :)

}
};

if (webpackMajorVersion === '4') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably use if (parseInt(webpackMajorVersion, 10) >= 4) to be future proof.

parseInt(webpackMajorVersion, 10) < testFlags.minimumWebpackMajorVersion) {
throw new Error('unsupported webpack version');
}
delete testFlags.minimumWebpackMajorVersion;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come you are deleting this? If set, would you not expect it to be present further down the execution flow? Maybe I am missunderstanding something :)


var hash = _loaderUtils2['default'].getHashDigest(compilation.assets[key].source(), 'sha1');
var source = compilation.assets[key].source();
if (source instanceof ArrayBuffer) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know of any other situation that could cause source to be an ArrayBuffer? (It shouldn't matter though, since the same logic should apply.)

@GGAlanSmithee
Copy link
Collaborator

@mstange I approved this with some minor comments, which you could look at. It would still require @NekR's approval before merge though

@NekR - the actual change in this PR is very minor and should not affect non-webassembly users, so I think it would be worth merging this. It's backwards compatible, so should fit in a patch / minor version

@NekR
Copy link
Owner

NekR commented May 3, 2019

@GGAlanSmithee I think I can merge this.

@NekR
Copy link
Owner

NekR commented May 3, 2019

Hmm, it fails CI after merge from master. Probably my or other PR changes did something to it.

@NekR
Copy link
Owner

NekR commented May 3, 2019

Okay, it seems to be because of newer webpack version. I'll resolve that locally.

@mstange thanks for contributing this. It's very much appreciated. Great work 👍

@GGAlanSmithee thanks for taking care of this. It wouldn't be possible to merge and all this PRs right without you help 💪 👍

@NekR NekR merged commit 4d6b6e6 into NekR:master May 3, 2019
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

Successfully merging this pull request may close these issues.

Build error when using a WebAssembly module

4 participants