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 in distribution #737

Closed
carpiediem opened this issue Mar 8, 2021 · 6 comments · Fixed by #741
Closed

ES6 in distribution #737

carpiediem opened this issue Mar 8, 2021 · 6 comments · Fixed by #741
Assignees

Comments

@carpiediem
Copy link

🐛 Bug Report

Expected Behaviour

Successful webpack build of our project

Actual Behaviour

SyntaxError: Unexpected token: punc ())

To Reproduce

  1. Use clipboard.js in a build process that expects ES5 modules
  2. Let your project's package.json select version 2.0.7
  3. Build fails
@carpiediem carpiediem added the bug label Mar 8, 2021
@carpiediem
Copy link
Author

This is easy for me to get around (by specifying v2.0.6), but I thought your team should know about the issue.

@vitormalencar
Copy link
Collaborator

vitormalencar commented Mar 8, 2021

@carpiediem Thanks a lot for the bug report, I will have a look into it

also, can you share one example of this env, that would be helpful =)

@vitormalencar
Copy link
Collaborator

@carpiediem can you share what Webpack/bundle config are you using?

@ding-js
Copy link

ding-js commented Mar 9, 2021

image

https://cdn.jsdelivr.net/npm/clipboard@2.0.7/dist/clipboard.js

There are arrow functions on the bundle of v2.0.7. It seems that was caused by upgrading to webpack 5

https://stackoverflow.com/questions/64620341/webpack-generates-arrow-function-in-es5

@vitormalencar
Copy link
Collaborator

@ding-js thanks a lot this is what I was looking for, looks like we need to specify the target on the webpack.config, target: ['web', 'es5'] I will create a PR in a bit

@vitormalencar
Copy link
Collaborator

So I just took some time today to create a new release, I included the webpack changes I hope it helps to solve the issue, if not I will continue to push more fixes =)

Please let me know if the issue is solved or not

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

Successfully merging a pull request may close this issue.

4 participants