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

Experimental module output drops external import assertions #16238

Open
laverdet opened this issue Sep 10, 2022 · 6 comments
Open

Experimental module output drops external import assertions #16238

laverdet opened this issue Sep 10, 2022 · 6 comments

Comments

@laverdet
Copy link

Bug report

What is the current behavior?
When using the experimental module output format import assertions are not emitted in the output.

This is related to #2933, @alexander-akait requested I open a new issue.

If the current behavior is a bug, please provide the steps to reproduce.
main.js

import test from "test" assert { type: "json" };
console.log(test);

package.json

{
  "name": "test",
  "type": "module",
  "dependencies": {
    "webpack": "^5.74.0",
    "webpack-cli": "^4.10.0"
  }
}

webpack.config.js

export default {
	entry: "./main.js",
	mode: "development",
	experiments: {
		outputModule: true,
	},
	externals: [
		"test",
	],
}

At the top of dist/main.mjs we get import * as __WEBPACK_EXTERNAL_MODULE_test__ from "test"; which will make applications fail under runtimes which expect the assertion (nodejs v18).

What is the expected behavior?
The assertion should be preserved in the output.

Other relevant information:
webpack version: 5.74.0
Node.js version: 18.9.0

@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

@pablomendezroyo
Copy link

Same issue

@webpack-bot
Copy link
Contributor

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

@alexander-akait
Copy link
Member

Marked as low because it is still on stage: 2 https://github.com/tc39/proposal-import-attributes and changed

@laverdet
Copy link
Author

@alexander-akait should this be reopened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Priority - High
Development

No branches or pull requests

5 participants