diff --git a/package.json b/package.json index c126810..9ce31b5 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": { diff --git a/src/index.js b/src/index.js index 053fcb4..95f6949 100644 --- a/src/index.js +++ b/src/index.js @@ -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); }