Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: I guess it's esm #37535
feat: I guess it's esm #37535
Changes from 5 commits
f356b39
42773e5
42bc762
0b7a829
8390ab0
7f0cf87
d89b339
7d93690
f149167
cca34de
acf384c
6f20236
2b16d4f
e179a92
d0601a3
39d87af
8cf4bf9
799ab67
66a088f
6f49f89
329c36e
62f9c28
5343b91
1f7bb22
2b8dd6d
0094ed7
98b65af
7eddf99
c31fcc1
2c78e92
dc1cc2e
7ac8691
438ad9b
3da5be8
b5da4ad
6a29c3d
b8601c8
37b02a7
7f17796
aa87ba1
0de8252
d74274e
ff86b12
27adf25
8a71118
c901f38
1bfa90c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the content of this section, it sounds like renderers can never import Node.js ESM modules, but that enabling
contextIsolation
can enablepreload
to load ESM modules. Should the title of this section be updated and/or merged with the one above?Alternately, maybe the focus of these sections should be on the only configuration where it is possible to use ESM imports to import Node scripts, which seems to be inside a preload script with sandboxing disabled and
contextIsolation
enabled.Final thought: if enabling ESM Node imports from preloads requires disabling an important security feature (sandboxing), is it worth supporting at all? Since none of this is already supported, it wouldn't be a regression to say "ESM imports are only supported in the Main process". Would that be a better (and simpler to document) line to draw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a misunderstanding here (which is good it shows the docs need improvement). Lemme draw a table and clarify something.
In the renderer process there are two different "ESM" loaders. Node's and Blinks. There are also two different ways of doing ESM imports. The static
import foo from 'bar'
directive and the dynamicimport('bar')
method. With this information in hand the table below should make more senseI think the misunderstanding here is that enabling "ESM Node imports" by definitions requires disabling the sandbox because it requires enabling "Node" in the first place.
The only two edge cases (which I tried to document here) are: