Open uruha opened 4 years ago
Encountered a similar error:
ncc: Version 0.25.1
ncc: Compiling file index.js
62kB dist/pre/index.js
70kB dist/pre/index.js.map
122kB dist/pre/sourcemap-register.js
184kB [548ms] - ncc 0.25.1
> pkg-size-action@0.0.0-semantic-release build:main /Users/privatenumber/gits/action
> ncc build -s -o dist/main src/index.js && :
ncc: Version 0.25.1
ncc: Compiling file index.js
Error: Module parse failed: Unexpected token (47:25)
File was processed with these loaders:
* ./node_modules/@vercel/ncc/dist/ncc/loaders/empty-loader.js
* ./node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js
* ./node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
| npm_lifecycle_event: event,
| npm_lifecycle_script: cmd,
> __webpack_require__.ab + "node-gyp.js",
| }),
| stdioString,
at /Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:3258160
at /Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:2210952
at eval (eval at create (/Users/privatenumber/gits/action/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:1:1140142), <anonymous>:11:1)
I identified that this was caused by @npmcli/run-script/lib/make-spawn-args.js:5
doing require.resolve('node-gyp/bin/node-gyp.js')
.
I fixed this by externalizing @npmcli/run-script
:
ncc build -s --external='@npmcli/run-script' -o dist/main src/index.js
and adding @npcli/runscript
and its dependencies to git.
PS, I recommend copy-pasting the error message instead of screen-shotting it so that people searching for this same error can find this issue.
@privatenumber
and adding @npcli/runscript and its dependencies to git
How exactly did you do this?
Sorry this was a long time ago and I don't remember this specific problem.
However, I do remember I realized ncc is not a requirement for developing GitHub Actions and just using Rollup is a lot easier and faster: https://github.com/pkg-size/action/blob/develop/rollup.config.js
@privatenumber Yea, I've tried rollup and could never get it to work. I have referenced your rollup config as well with no luck π€· Thanks for the reply though, appreciate it :)
Hi !, I have a question about building ncc π₯Ί.
Currently, I'm developing
github-actions
that usesnpm-check-updates
, but apparently when I build index.js that requiresnpm-check-updates
, I get the following error Appears and I cannot output.Is there any correspondence or setting that we have to do? Is the node version affected? ? ? This build also had a similar error with the TypeScript version.
Verification please!
π PR currently supported