Skip to content

Commit de76260

Browse files
committed
add bundle-time error for non-web-workers where target is node
1 parent b54d7e8 commit de76260

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/utils/buildWorkerCode.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export default WorkerFactory;
5959

6060
function buildWorkerCode(source, sourcemap = null, optionsArg = kDefaultsOptions) {
6161
const options = Object.assign({}, kDefaultsOptions, optionsArg);
62+
if (options.targetPlatform === 'node' && options.type !== 'web-worker') {
63+
throw new Error(`rollup-plugin-web-worker-loader only supports web-workers in node. ${options.type} is unavailable.`);
64+
}
6265
const factoryFuncName = getFactoryFuncName(options);
6366
const argsString = getArgsString(source, sourcemap, options);
6467
return buildWorkerSource(options, factoryFuncName, argsString);

0 commit comments

Comments
 (0)