Morgul / snowpack-plugin-vue2

A snowpack vue2 compiler that reuses `@snowpack/plugin-vue` verbatim.
MIT License
6 stars 2 forks source link

nullish coalescing is not supported in node v12 #4

Closed kristofgilicze closed 3 years ago

kristofgilicze commented 3 years ago

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. https://github.com/nodejs/node/issues/33007#issuecomment-617968420

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 commented 3 years ago

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.

Morgul commented 3 years ago

Fixed in 0353b693e14714b65a8aeae1fabc93da470d3f9f.

Released as v0.4.1

kristofgilicze commented 3 years ago

This line is also guilty: https://github.com/Morgul/snowpack-plugin-vue2/blob/80c39845a2f659e041f05a2a063b9f2a360db1fd/compiler/index.js#L50

Morgul commented 3 years ago

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

Morgul commented 3 years ago

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

kristofgilicze commented 3 years ago

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 commented 3 years ago

published at v0.4.2.