evt icon indicating copy to clipboard operation
evt copied to clipboard

Webpack target ES5

Open rtalon83 opened this issue 4 years ago • 3 comments

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!

rtalon83 avatar Feb 08 '21 08:02 rtalon83

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

garronej avatar Feb 08 '21 17:02 garronej

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.

rtalon83 avatar Feb 09 '21 07:02 rtalon83

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.

garronej avatar Feb 09 '21 19:02 garronej