Open FredKSchott opened 4 years ago
Hi @FredKSchott , I find this seems has been done in the rollup-plugin-catch-unresolved, and throws when running snowpack dev
with this nice error printed like this:
snowpack
▼ Console
[snowpack] installing dependencies...
[snowpack] ../../../node_modules/node-builtin-pkg/entrypoint.js
Module "path" (Node.js built-in) is not available in the browser. Run Snowpack with --polyfill-node to fix.
[snowpack] Install failed.
error Command failed with exit code 1.
But in snowpack build
it is not catched, and passing normally:
yarn snowpack build
yarn run v1.22.4
$ /Users/jennie.ji/Projects/snowpack/node_modules/.bin/snowpack build
[snowpack] ! building source…
[snowpack] ✔ build complete [0.02s]
[snowpack] installing dependencies...
[snowpack] ! verifying build...
[snowpack] ✔ verification complete
[snowpack] ! writing build to disk...
[snowpack] ✔ build complete [0.02s]
[snowpack] ▶ Build Complete!
Which seems just because the dev command is wrapped by a try catch but build does not. Shall I try to add try catch wrapping the whole build process? Not sure what is the impact...
Original Discussion: Follow up from https://github.com/pikapkg/snowpack/discussions/1085 /cc @briwa
This is a follow up to an issue raised by @briwa, where the solution to "global is not defined" was not obvious. We should be able to detect this either ahead of time or inside the
onwarn
handler, and raise a warning that include info on how to resolve with this flag/config option.