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

Add support for package shipped as ES2020+ JavaScript #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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