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

Webpack target ES5 #18

Open
rtalon83 opened this issue Feb 8, 2021 · 3 comments
Open

Webpack target ES5 #18

rtalon83 opened this issue Feb 8, 2021 · 3 comments

Comments

@rtalon83
Copy link

rtalon83 commented Feb 8, 2021

Hi!

First, congratulations for this library.
I'm making another library where there are extended classes from Evt. I use rollup to build with params:

rollup -> format: es
tsconfig -> module: ES2015, target: ES6

This library run ok!

Then, I use this library in other project under webpack.

Some params are:

tsconfig -> target: ES5

webpack build ok!

But running my final app there is a error:

TypeError: Class constructor MyClass cannot be invoked without 'new'

What is the problem?
Thanks!

@garronej
Copy link
Owner

garronej commented Feb 8, 2021

Hey @rtalon83,
Thank you for the kind words,

I will do my best to help you, is your project open source? It would help me if I could reproduce.

Regards

@rtalon83
Copy link
Author

rtalon83 commented Feb 9, 2021

Hi again!

Thanks for your quick response. I found the solution.
My main idea is to do a "valid tree-shaking library" so I followed a steps, first build with "rollup" (because this tool export ES-Module) and, then, include this library in any project.
In my case "rollup" must export with target=ES5 (I exported in ES6) and the second project using webpack target=ES5 too.
In this moment the test-app is running (PIXI.js + EVT + TypeScript + Rollup + Webpack).

If you want to see more details about my project I can write it here.

@garronej
Copy link
Owner

garronej commented Feb 9, 2021

Thank you for the detail,
I am glad your problem is solved.

I am currently actively working on v2 that will be a major update over v1.
I am very open to suggestions.
If you could tel me what things you wish where different with the lib, what you may have found confusing or describe the features that you find yourself using the most. It would be very cool.

gitbook-com bot pushed a commit that referenced this issue Jul 19, 2022
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