Closed Bug 1517546 Opened 4 years ago Closed 4 years ago

Enable dynamic module import by default

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox66 --- disabled
firefox67 + fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Dynamic module import as implemented in bug 1342012 is currently disabled by default behind the javascript.options.dynamicImport pref.
Component: DOM → JavaScript Engine
Depends on: 1342012
OS: Unspecified → All
Hardware: Unspecified → All
Priority: -- → P2
Depends on: 1522491

Tracking for 67 as it will probably deserve a mention in out developers release notes.

This has been enabled in nightly since the end of January and there haven't been any major bugs found. (Bug 1529203 was discovered but this was already present). What do you think about enabling this by default and letting it ride the trains, to ship in 67?

Please send email about this to dev.platform

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6ce854f480d6
Enable dyanmic module import by default r=smaug
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67

Hi, maybe I'm doing something wrong, but I'm not able to import a module in a webextension content script via the dynamic import. I also tried this version which works in chrome: https://github.com/otiai10/chrome-extension-es6-import

By trying it myself I got the following errors:
Error: TelemetryStopwatch: key "WEBEXT_CONTENT_SCRIPT_INJECTION_MS" was already initialized ExtensionTelemetry.jsm:106:31
Error: TelemetryStopwatch: key "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID" was already initialized ExtensionTelemetry.jsm:110:41
Error: TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS", key: "" ExtensionTelemetry.jsm:106:31
Error: TelemetryStopwatch: requesting elapsed time for nonexisting stopwatch. Histogram: "WEBEXT_CONTENT_SCRIPT_INJECTION_MS_BY_ADDONID"

However the provided add-on above does not produce any errors, but still doesn't log anything to the console.

Firefox Developer Edition 66.0b14 (64-Bit), Linux with enabled javascript.options.dynamicImport pref;

(In reply to robbendebiene from comment #6)

I've filed bug 1536094 for this.

Note to MDN writers:

We've already added a note about this to the Fx67 rel notes:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/67#JavaScript

It looks like the BCD for import() could do with being updated

I also think it'd make sense to include a tutorial somewhere (in the JS guide?) explaining JS module import/export, how to use them, etc.

I've also finished rabbit-holing on my guide to JS modules:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

With that, I think the docs here and now complete. Feel free to give me a shout if you notice anything that isn't quite right.

You need to log in before you can comment on or make changes to this bug.