Skip to content

Commit 3e397bd

Browse files
authored
Fix importing threads main entrypoint in worker (#24)
Fixes andywer/threads#291.
1 parent de0dc95 commit 3e397bd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/loader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export function pitch (request) {
5959
const workerCompiler = this._compilation.createChildCompiler(NAME, workerOptions, plugins);
6060
workerCompiler.context = this._compiler.context;
6161

62-
if (pluginOptions.target && /\bnode\b/.test(pluginOptions.target)) {
62+
const target = pluginOptions.target || compilerOptions.target
63+
64+
if (target && /\bnode\b/.test(target)) {
6365
new NodeTargetPlugin().apply(workerCompiler);
6466
}
6567
(new WebWorkerTemplatePlugin(workerOptions)).apply(workerCompiler);

0 commit comments

Comments
 (0)