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

Module build failed after bugfix in package (msw) #559

Open
BoussonKarel opened this issue Jan 19, 2023 · 5 comments
Open

Module build failed after bugfix in package (msw) #559

BoussonKarel opened this issue Jan 19, 2023 · 5 comments

Comments

@BoussonKarel
Copy link

BoussonKarel commented Jan 19, 2023

Issue

Hi, I just updated msw from 0.49.2 to 0.49.3 and now my build started failing:

Error

...

ERROR in ./node_modules/strict-event-emitter/lib/Emitter.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: C:\Users\Karel\msw-auto-import-bug\node_modules\strict-event-emitter\lib\Emitter.js: Class private methods are not enabled. Please add `@babel/plugin-proposal-private-methods` to your configuration.
  24 |         this.#hasWarnedAboutPotentialMemortyLeak = false;
  25 |     }
> 26 |     #getListeners(eventName) {
     |     ^
  27 |         return this.#events.get(eventName) || [];
  28 |     }
  29 |     #removeListener(listeners, listener) {
    at File.buildCodeFrameError (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\core\lib\transformation\file\file.js:205:12)
    at NodePath.buildCodeFrameError (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\path\index.js:105:21)
    at shouldTransform (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\helper-create-class-features-plugin\lib\features.js:108:29)
    at PluginPass.Class (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\helper-create-class-features-plugin\lib\index.js:82:44)
    at newFn (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\visitors.js:143:21)
    at NodePath._call (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\path\context.js:45:20)
    at NodePath.call (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\path\context.js:35:17)
    at NodePath.visit (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\path\context.js:80:31)
    at TraversalContext.visitQueue (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\context.js:86:16)
    at TraversalContext.visitMultiple (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\context.js:61:17)
    at TraversalContext.visit (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\context.js:107:19)
    at traverseNode (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\traverse-node.js:18:17)
    at NodePath.visit (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\path\context.js:86:52)
    at TraversalContext.visitQueue (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\traverse\lib\context.js:86:16)
    at run.next (<anonymous>)    at transform (C:\Users\Karel\msw-auto-import-bug\node_modules\@babel\core\lib\transform.js:22:41)    at transform.next (<anonymous>)
    at step (C:\Users\Karel\msw-auto-import-bug\node_modules\gensync\index.js:261:32)    at C:\Users\Karel\msw-auto-import-bug\node_modules\gensync\index.js:273:13
    at async.call.result.err.err (C:\Users\Karel\msw-auto-import-bug\node_modules\gensync\index.js:223:11)
 @ ./node_modules/strict-event-emitter/lib/index.js 1:626-646 @ ./node_modules/msw/lib/index.js 118:77-108
 @ ../AppData/Local/Temp/broccoli-13380PYYd73vg6ots/cache-153-webpack_bundler_ember_auto_import_webpack/app.cjs 15:37-51

Build Error (WebpackBundler)
webpack returned errors to ember-auto-import


Stack Trace and Error Report: C:\Users\Karel\AppData\Local\Temp/error.dump.897292a5a81aaa1fc4ba78a6fac425a2.log

error.dump.ed21c83f59006d777e2b06b69c6cb6d1.log

Reproduction

I have reproduced the error in a new Ember addon:
Broken build: https://github.com/BoussonKarel/msw-auto-import-bug
Working build: https://github.com/BoussonKarel/msw-auto-import-bug/tree/[email protected]

@BoussonKarel
Copy link
Author

It was resolved by the author of strict-event-emitter: https://github.com/open-draft/strict-event-emitter/releases/tag/v0.4.4 by removing the class private methods, but that does not resolve this ember-auto-import bug I guess.

@andreyfel
Copy link
Contributor

It fails now in the same way after msw update to v2.0.

@andreyfel
Copy link
Contributor

@ef4 do you have any thoughts on this?

@ef4
Copy link
Collaborator

ef4 commented Oct 23, 2023

The legacy decorators plugin makes several other class-feature plugins mandatory, including @babel/plugin-proposal-private-methods.

We add legacy decorators here:

[require.resolve('@babel/plugin-proposal-decorators'), { legacy: true }],

That same spot should add the other plugins that legacy-decorators require. We already have @babel/plugin-proposal-class-properties but we should add @babel/plugin-proposal-private-methods and @babel/plugin-transform-class-static-block.

@andreyfel
Copy link
Contributor

@ef4 please take a look at #596

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

3 participants