Skip to content

Add support for package shipped as ES2020+ JavaScript#54

Open
titouanmathis wants to merge 2 commits intopastelsky:masterfrom
titouanmathis:master
Open

Add support for package shipped as ES2020+ JavaScript#54
titouanmathis wants to merge 2 commits intopastelsky:masterfrom
titouanmathis:master

Conversation

@titouanmathis
Copy link

Package shipping ES2020+ JavaScript fails to build with Module parse failed: Unexpected token errors. Some examples:

Module parse failed: Unexpected token (8:18)
File was processed with these loaders:
 * ./node_modules/shebang-loader/index.js
 * ./node_modules/string-replace-loader/index.js
You may need an additional loader to handle the result of these loaders.
| const cache = /* @__PURE__ */ new WeakMap();
| class Transition {
>   isTransitioning = false;
|   transitionEndHandler = null;
|   constructor(element) {

Module parse failed: Unexpected token (46:17)
File was processed with these loaders:
 * ./node_modules/shebang-loader/index.js
 * ./node_modules/string-replace-loader/index.js
You may need an additional loader to handle the result of these loaders.
| }
| class Base extends EventTarget {
>   static $isBase = true;
|   $parent = null;
|   $id;

Adding the esbuild-loader with the target set to es2019 before the shebang-loader and string-replace-loader loaders fixes the errors.

I am not certain about all the side effects that this change could trigger, but the test suites are passing.

Please let me know if this is not the correct solution for the above errors.

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

Successfully merging this pull request may close these issues.

1 participant