Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mischnic committed Jun 30, 2021
1 parent 48791c2 commit 1285590
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/transformers/js/src/JSTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,17 @@ export default (new Transformer({
for (let dep of dependencies) {
if (dep.kind === 'WebWorker') {
// Use native ES module output if the worker was created with `type: 'module'` and all targets
// support native module workers. Only do this if the source type is changing from script to module
// though so that assets can be shared between workers and the main thread in the global output format.
let outputFormat = asset.env.outputFormat;
// support native module workers. Only do this if parent asset output format is also esmodule so that
// assets can be shared between workers and the main thread in the global output format.
let outputFormat;
if (
asset.env.sourceType === 'script' &&
asset.env.outputFormat === 'esmodule' &&
dep.source_type === 'Module' &&
supportsModuleWorkers
) {
outputFormat = 'esmodule';
} else {
outputFormat = 'global';
}

let loc = convertLoc(dep.loc);
Expand Down

0 comments on commit 1285590

Please sign in to comment.