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

es6 code sneak in / breaks ie11 #213

Closed
lhtdesignde opened this issue Jan 21, 2021 · 9 comments · Fixed by #216
Closed

es6 code sneak in / breaks ie11 #213

lhtdesignde opened this issue Jan 21, 2021 · 9 comments · Fixed by #216
Labels
bug Something isn't working

Comments

@lhtdesignde
Copy link

lhtdesignde commented Jan 21, 2021

Expected Behavior

There should be es5 code only is dist build.

Actual Behavior

When building the latest version 1.2.1 with webpack for production, it adds es6 code into the dist build.
I'm not 100% sure why that is, as I couldn't find the "const" dist build itself.
For me this new addition gets also compiled:
4caa88c#diff-d6299b5bb2afc0956126a0adb12fd89829e01a4cc025e7277a092228b96f32e4R4

If any helpful, this is how it looks when compiled:
Screen Shot 2021-01-21 at 13 58 10

When I downgrade to version 1.2.0, that is fine and IE11 works. Is there a chance to make this es5 code?

Environment

  • Version: 1.2.1
  • Platform: mac os big sur, webpack 5
  • Browser: IE11
@remarkablemark
Copy link
Owner

Thanks for opening this issue @lhtdesignde

This is happening because webpack prioritizes module over main from package.json:

So instead of:

// webpack.config.js
module.exports = {
  //...
  resolve: {
    mainFields: ['browser', 'module', 'main'],
  },
};

See if you can do:

// webpack.config.js
module.exports = {
  //...
  resolve: {
    mainFields: ['browser', 'main', 'module'],
  },
};

See resolve.mainFields

@remarkablemark
Copy link
Owner

Also, what version of webpack are you using?

@lhtdesignde
Copy link
Author

webpack 5.16.0

@lhtdesignde
Copy link
Author

SO good! Thanks for this answer @remarkablemark. That made it work!

@remarkablemark
Copy link
Owner

Great to hear! Can this issue be closed @lhtdesignde?

@lhtdesignde
Copy link
Author

yes thanks!

@remarkablemark
Copy link
Owner

remarkablemark commented Jan 28, 2021

Just a heads up @lhtdesignde, I published v1.2.4, which refactors ES6 to ES5 syntax in index.mjs.

This should fix the root cause of your issue (you can undo your webpack.config.js changes).

@lhtdesignde
Copy link
Author

lhtdesignde commented Feb 1, 2021

thank you very much! I prefer that since the change in my config caused my vendor file to significantly increase in size.

@remarkablemark
Copy link
Owner

You're welcome! Let me know if you encounter any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants