Bug 164860 - [ES6] Worker should support ES6 modules
Summary: [ES6] Worker should support ES6 modules
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
Depends on: 164425
Blocks: 147340 192329 165724
  Show dependency treegraph
Reported: 2016-11-17 01:18 PST by Yusuke Suzuki
Modified: 2019-09-11 11:47 PDT (History)
10 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2016-11-17 01:18:38 PST
Comment 1 Saleh Abdel Motaal 2018-07-07 05:59:18 PDT
It seems that support `new Worker(…, {type: "module"})` is limited or missing.

In a project that uses only pure ES modules served using a very basic express server (ie express.static) over or http://localhost:8080 a worker module with static import statements:

import {…} from '…'

  SyntaxError: Unexpected token '{'. import call expects exactly one argument.

It should be noted that those static import statements are synthesized using rollup and the resulting files sometimes include one or more variable declarations before the occurrence of the import statements.

The same project does not throw in Chrome.
Comment 2 Guy Bedford 2019-09-11 11:47:33 PDT
Note that supporting dynamic `import()` in Web Workers can also be a first start along these lines.