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

Private class fields break build #499

Closed
dominiklessel opened this issue Jan 16, 2020 · 6 comments
Closed

Private class fields break build #499

dominiklessel opened this issue Jan 16, 2020 · 6 comments

Comments

@dominiklessel
Copy link

I have a project, which uses hapi. With their latest 19.x release they dropped support for node 10 and make use of for example private class fields, which now breaks my ncc build :

> ncc build

ncc: Version 0.20.5
ncc: Compiling file index.js
Error: Module parse failed: Unexpected character '#' (17:4)
File was processed with these loaders:
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| exports = module.exports = internals.Auth = class {
| 
>     #core = null;
|     #schemes = {};
|     #strategies = {};
Module parse failed: Unexpected token (51:12)
File was processed with these loaders:
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| exports = module.exports = internals.Core = class {
| 
>     actives = new WeakMap();                                                   // Active requests being processed
|     app = {};
|     auth = new Auth(this);
Module parse failed: Unexpected token (12:9)
File was processed with these loaders:
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| exports = module.exports = internals.Ext = class {
| 
>     type = null;
|     nodes = null;
| 
Module parse failed: Unexpected token (246:10)
File was processed with these loaders:
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| exports.ValidationError = class extends Error {
| 
>     isJoi = true;
|     name = 'ValidationError';
| 
Module parse failed: Unexpected character '#' (8:4)
File was processed with these loaders:
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/empty-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/relocate-loader.js
 * ./node_modules/@zeit/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| exports.Team = internals.Team = class {
| 
>     #meetings = null;
|     #count = null;
|     #notes = null;
    at evalmachine.<anonymous>:1:1501918
    at eval (eval at create (evalmachine.<anonymous>:1:273391), <anonymous>:13:1)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)

Please see their changelogs:

Is there any way around it?

@ngduc
Copy link

ngduc commented Jun 13, 2020

I'm also getting this issue today. Thanks.

@hatemjaber
Copy link

What does You may need an additional loader to handle the result of these loaders mean? How do you add additional loaders so that when you run ncc build... it knows to use them? I've been searching trying to find an answer and can't seem to find one.

@itsdarrylnorris
Copy link

@dominiklessel Are you aware of a workaround?

@dominiklessel
Copy link
Author

@itsdarrylnorris No, unfortunately not – I've stopped using ncc because of this … I know that this is not a feasible solution for everyone, but in my case it was (and I was too lazy to figure out a proper fix 😬)

Have a look at https://github.com/OnurGvnc/acorn-with-stage3 this looks like a possible workaround 👍

@Dunky13
Copy link

Dunky13 commented May 25, 2021

Facing this problem too, but the acorn suggestion doesn't work for me.

@styfle styfle added the bug Something isn't working label May 25, 2021
@guybedford
Copy link
Contributor

@Dunky13 I just tested this and private fields definitely seem to be supported. Are you sure you're using the latest version?

@guybedford guybedford removed the bug Something isn't working label May 29, 2021
@styfle styfle closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2023
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

7 participants