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

打包后的产物 x.moduel.mjs 存在箭头函数,导致IE 无法兼容 #1065

Closed
hduhdc opened this issue Nov 16, 2023 · 3 comments
Closed

Comments

@hduhdc
Copy link

hduhdc commented Nov 16, 2023

打包后的产物 x.moduel.mjs 存在箭头函数,导致IE 无法兼容
Object.keys({name:1}).forEach(key => {
console.log(key)
});
打包后结果
Object.keys({name:1}).forEach(e=>{console.log(e)}); //# sourceMappingURL=test-microbundle.modern.mjs.map

@hduhdc hduhdc changed the title modern.mjs 打包后的产物 x.moduel.mjs 存在箭头函数,导致IE 无法兼容 Nov 16, 2023
@rschristian
Copy link
Collaborator

rschristian commented Nov 16, 2023

This is correct behavior. The modern output is ES2017: https://github.com/developit/microbundle#-modern-mode-

If you really need IE support, use CJS, ESM, or UMD outputs. Modern is specifically for dropping the baggage those formats ship with.

@rschristian
Copy link
Collaborator

Please use English, I don't understand what you're trying to say.

@hduhdc
Copy link
Author

hduhdc commented Nov 16, 2023

Please use English, I don't understand what you're trying to say.
I know my mistake,if my packge is foo,when i use import foo from 'foo '
If the configuration of my package. json is as follows
"exports": {

"default": "./lib/foo.js" 

},
Is it possible to avoid using it by default ./lib/modern.mjs

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

No branches or pull requests

2 participants