Support non-esm modules #2

Closed
kapouer wants to merge 1 commit from kapouer/nonesm into master
kapouer commented 2021-01-08 22:23:18 +01:00 (Migrated from github.com)

The simplicity of it is so cool. It's a proof-of-concept however - i'm a noobie w.r.t. acorn.

The simplicity of it is so cool. It's a proof-of-concept however - i'm a noobie w.r.t. acorn.
marijnh commented 2021-01-08 22:45:42 +01:00 (Migrated from github.com)

Did github mangle the (code.charAt(ast.start) == "" ? "" : "") expressions or is there something I don't understand going on there?

Did github mangle the `(code.charAt(ast.start) == "" ? "" : "")` expressions or is there something I don't understand going on there?
kapouer commented 2021-01-08 23:20:58 +01:00 (Migrated from github.com)

Not github, me - to be able to diff i removed semicolons too agressively.

Not github, me - to be able to diff i removed semicolons too agressively.
kapouer commented 2021-01-08 23:22:54 +01:00 (Migrated from github.com)

That should fix it

That should fix it
kapouer commented 2021-01-08 23:24:02 +01:00 (Migrated from github.com)

I don't expect these PR to be accepted right away - please consider them as inspiration, if that's not too much to ask :)

I don't expect these PR to be accepted right away - please consider them as inspiration, if that's not too much to ask :)
marijnh commented 2021-01-10 19:01:38 +01:00 (Migrated from github.com)

What do you want to do with require calls?

What do you want to do with `require` calls?
kapouer commented 2021-01-10 19:13:11 +01:00 (Migrated from github.com)

Nothing: most front-end modules come in a single require-able bundle, so exporting module.exports using that patch, es6-style, is just enough to be able to import the npm-installed bundled module.

Nothing: most front-end modules come in a single require-able bundle, so exporting module.exports using that patch, es6-style, is just enough to be able to import the npm-installed bundled module.
kapouer commented 2021-01-10 19:14:48 +01:00 (Migrated from github.com)

Though replacing require x by import from x would be elegant but i fear the hidden complexities.

Though replacing `require x` by `import from x` would be elegant but i fear the hidden complexities.
marijnh commented 2021-01-11 11:32:52 +01:00 (Migrated from github.com)

most front-end modules come in a single require-able bundle

In my experience the concept of dependencies is definitely also used in many front-end modules. So shipping a solution that just ignores that doesn't feel very reasonable. (I intentionally didn't provide any support for non-ES modules initially because I'm not that interested in being pulled into the morass of trying to make this work.)

> most front-end modules come in a single require-able bundle In my experience the concept of dependencies is definitely also used in many front-end modules. So shipping a solution that just ignores that doesn't feel very reasonable. (I intentionally didn't provide any support for non-ES modules initially because I'm not that interested in being pulled into the morass of trying to make this work.)
marijn closed this pull request 2026-03-18 10:44:41 +01:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/esmoduleserve!2
No description provided.