Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed May 7, 2020
1 parent c3fa22f commit 2688667
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "workerize-loader",
"version": "1.1.0",
"version": "1.2.0",
"description": "Automatically move a module into a Web Worker (Webpack loader)",
"main": "dist/index.js",
"repository": "developit/workerize-loader",
Expand Down Expand Up @@ -35,8 +35,8 @@
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-developit": "^1.1.1",
"karmatic": "^1.3.1",
"microbundle": "^0.12.0-next.8",
"karmatic": "^1.4.0",
"microbundle": "0.12.0-next.8",
"webpack": "^4.39.2"
},
"dependencies": {
Expand Down
11 changes: 6 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,23 @@ loader.pitch = function(request) {
if (this.target!=='webworker' && this.target!=='web') {
(new NodeTargetPlugin()).apply(worker.compiler);
}

// webpack >= v4 supports webassembly
let wasmPluginPath = null;
try {
wasmPluginPath = require.resolve(
'webpack/lib/web/FetchCompileWasmTemplatePlugin'
'webpack/lib/web/FetchCompileWasmTemplatePlugin'
);
} catch (_err) {
}
catch (_err) {
// webpack <= v3, skipping
}

if (wasmPluginPath) {
// eslint-disable-next-line global-require, import/no-dynamic-require
// eslint-disable-next-line global-require
const FetchCompileWasmTemplatePlugin = require(wasmPluginPath);
new FetchCompileWasmTemplatePlugin({
mangleImports: this._compiler.options.optimization.mangleWasmImports,
mangleImports: this._compiler.options.optimization.mangleWasmImports
}).apply(worker.compiler);
}

Expand Down

0 comments on commit 2688667

Please sign in to comment.