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

nullish coalescing is not supported in node v12 #4

Closed
kristofgilicze opened this issue Jun 25, 2021 · 7 comments
Closed

nullish coalescing is not supported in node v12 #4

kristofgilicze opened this issue Jun 25, 2021 · 7 comments

Comments

@kristofgilicze
Copy link

kristofgilicze commented Jun 25, 2021

Hey, thanks for your work!

I bumped into this line:
https://github.com/Morgul/snowpack-plugin-vue2/blob/80c39845a2f659e041f05a2a063b9f2a360db1fd/compiler/index.js

compilerParseOptions: { pad: pad ?? 'line' },
                                  ^

SyntaxError: Unexpected token '?'

Ubuntu still ships v10 as default.
nodejs/node#33007 (comment)

Not a huge problem, but I belive you should not drop compatiblity for what seems to be a single line / syntax sugar.

This below is 100% the same.
Babel output with nodeV12:

// node >= v14.0.0
pad ?? 'line';

// node >= 10 ( 12 )
"use strict";

var _pad;

(_pad = pad) !== null && _pad !== void 0 ? _pad : 'line';

There is likely a more elegant equivalent, but I would like to keep the plugin in-tact for everyone else.

@Morgul
Copy link
Owner

Morgul commented Jun 25, 2021

Good catch. (I've just been spoiled by writing TS for the last year or so.)

You're right, no need to break backwards compatibility. I'll get that fixed up.

kristofgilicze added a commit to kristofgilicze/snowpack-plugin-vue2 that referenced this issue Jun 25, 2021
@Morgul
Copy link
Owner

Morgul commented Jun 25, 2021

Fixed in 0353b69.

Released as v0.4.1

@Morgul Morgul closed this as completed Jun 25, 2021
@kristofgilicze
Copy link
Author

This line is also guilty:

const scopeId = options?.compilerOptions?.scopeId;

@Morgul
Copy link
Owner

Morgul commented Jun 25, 2021

Ah, ok. that can also be handled pretty easily. Any others?

@Morgul Morgul reopened this Jun 25, 2021
@Morgul
Copy link
Owner

Morgul commented Jun 25, 2021

fixed in ceddf83. Let me know if you find anything else, and if it works, I'll push out another release.

@kristofgilicze
Copy link
Author

I'm still stuck, though this one is coming straight from Snowpack.

[21:15:51] [snowpack] Package "animated" not found. Have you installed it? 
[21:15:51] [snowpack] Error: Package "animated" not found. Have you installed it? 
    at Object.resolveEntrypoint (/static/node_modules/snowpack/lib/index.js:94190:15)
    at PackageSourceLocal.buildPackageImport (/static/node_modules/snowpack/lib/index.js:123257:34)
    at async PackageSourceLocal.prepare (/static/node_modules/snowpack/lib/index.js:123060:13)
    at async startServer (/static/node_modules/snowpack/lib/index.js:182486:9)
    at async Object.command (/static/node_modules/snowpack/lib/index.js:183136:9)
    at async cli (/static/node_modules/snowpack/lib/index.js:183802:9)
error Command failed with exit code 1.

I'm not sure about what is 'animated' - I did find a package 'animated' but that is for React Native.
I tried animated.less with no success.

So yes, last of the type described in the issue.

Thank you!

@Morgul
Copy link
Owner

Morgul commented Jun 25, 2021

published at v0.4.2.

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

2 participants