Skip to content
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

Implement import assertions #11917

Closed
xtuc opened this issue Nov 3, 2020 · 4 comments
Closed

Implement import assertions #11917

xtuc opened this issue Nov 3, 2020 · 4 comments

Comments

@xtuc
Copy link
Member

xtuc commented Nov 3, 2020

Feature request

What is the expected behavior?
webpack can use https://github.com/tc39/proposal-import-assertions to enforce JavaScript module type at runtime or build time (like with JSON modules, presumably based on file extension).

What is motivation or use case for adding/changing the behavior?
For security reasons browser will use the syntax for some non JavaScript Module types. Even if webpack doesn't necessarily suffers from that concern, we should make it consistent with browsers.

It could help webpack's runtime when loading/parsing resource into JavaScript modules if the file extension isn't available on a file system or expose to loaders to run on a certain module types only.

How should this be implemented in your opinion?
Acorn needs to support the syntax

Are you willing to work on this yourself?
yes

@xtuc
Copy link
Member Author

xtuc commented Dec 13, 2020

I implemented the parser plugin in acorn for import assertions: https://github.com/xtuc/acorn-import-assertions

xtuc added a commit to xtuc/webpack that referenced this issue Dec 27, 2020
xtuc added a commit to xtuc/webpack that referenced this issue Dec 27, 2020
xtuc added a commit to xtuc/webpack that referenced this issue Dec 28, 2020
xtuc added a commit to xtuc/webpack that referenced this issue Dec 28, 2020
xtuc added a commit to xtuc/webpack that referenced this issue Dec 28, 2020
xtuc added a commit to xtuc/webpack that referenced this issue Jan 24, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Jan 24, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Feb 21, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Mar 28, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Mar 28, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Mar 28, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Apr 3, 2021
xtuc added a commit to xtuc/webpack that referenced this issue Apr 3, 2021
@webpack-bot
Copy link
Contributor

This issue had no activity for at least three months.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

bump

@alexander-akait
Copy link
Member

Done #12278

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants