Implement dynamic module import #1691

Open
opened 2 years ago by Moonchild · 5 comments
Owner

This is for adding a "function-like" import() module loading syntactic form to JavaScript, that websites try to use instead of the previously-established ES6 modules loading and unloading methods.

Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1342012
Prerequisite: https://bugzilla.mozilla.org/show_bug.cgi?id=1484948
Pre-prerequiquite: https://bugzilla.mozilla.org/show_bug.cgi?id=1424420

Various crash followup bugs linked in the ref bug.

This is for adding a "function-like" import() module loading syntactic form to JavaScript, that websites try to use instead of the previously-established ES6 modules loading and unloading methods. Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Prerequisite: https://bugzilla.mozilla.org/show_bug.cgi?id=1484948 Pre-prerequiquite: https://bugzilla.mozilla.org/show_bug.cgi?id=1424420 Various crash followup bugs linked in the ref bug.
Moonchild added the
Javascript
Enhancement
Web Compatibility
labels 2 years ago

Currently sites built with SvelteKit break with the following error shown in the console.

SyntaxError: expected expression, got keyword 'import'[Learn More]

There is no way to get around the issue with for example shimport as the framework itself renders import() function calls during build time.

The SvelteKit dev team envisioned support of legacy browsers (#12) but there is no clear plan on how to do that yet.

Currently sites built with [SvelteKit](https://github.com/sveltejs/kit) break with the following error shown in the console. `SyntaxError: expected expression, got keyword 'import'`[[Learn More]](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Unexpected_token?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default) There is no way to get around the issue with for example [shimport](https://github.com/rich-harris/shimport) as the framework itself renders `import()` function calls during build time. The SvelteKit dev team envisioned support of legacy browsers [(#12)](https://github.com/sveltejs/kit) but there is no clear plan on how to do that yet.

https://github.com/WaterfoxCo/Waterfox-Classic/issues/121

Not sure if that can be applied or modified also for Pale Moon, but that guy there seems to have patches for dynamic module import for Waterfox Classic - based on Firefox 56

and 56 is not that far away from the UXP fork point.

https://github.com/WaterfoxCo/Waterfox-Classic/issues/121 Not sure if that can be applied or modified also for Pale Moon, but that guy there seems to have patches for dynamic module import for Waterfox Classic - based on Firefox 56 and 56 is not that far away from the UXP fork point.
Poster
Owner

That guy seems to have just applied all Moz patches regardless (and he's not separated his issues out). there's 100 commits in the first 2 links, for starters.
I also don't think that can be done easily here because between out fork point and firefox 56 there was quite a bit of refactoring done on the JS engine and how it handles events and modules.

That guy seems to have just applied all Moz patches regardless (and he's not separated his issues out). there's 100 commits in the first 2 links, for starters. I also don't think that can be done easily here because between out fork point and firefox 56 there was quite a bit of refactoring done on the JS engine and how it handles events and modules.

Is perhaps this updated Pull request of this guy from the Waterfox repo more of use now in the way that at least it allows to take some certain eleents which would help you with the issue here on the UXP side?

Part 1
https://github.com/WaterfoxCo/Waterfox-Classic/pull/143

Part2
https://github.com/WaterfoxCo/Waterfox-Classic/pull/144

Is perhaps this updated Pull request of this guy from the Waterfox repo more of use now in the way that at least it allows to take some certain eleents which would help you with the issue here on the UXP side? Part 1 https://github.com/WaterfoxCo/Waterfox-Classic/pull/143 Part2 https://github.com/WaterfoxCo/Waterfox-Classic/pull/144
Poster
Owner

I'm not entirely sure we will be able to cherry pick here. mozilla's implementation is pretty deeply depending on a bunch of refactoring of the parser and it gets thick quickly because we're somehow forced to accept import in multiple ways simultaneously. All of this makes heavy use of subclasses and templates and I've always struggled with those in C++.

I'm not entirely sure we will be able to cherry pick here. mozilla's implementation is pretty deeply depending on a bunch of refactoring of the parser and it gets thick quickly because we're somehow forced to accept `import` in multiple ways simultaneously. All of this makes heavy use of subclasses and templates and I've always struggled with those in C++.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: MoonchildProductions/UXP#1691
Loading…
There is no content yet.