vicary
vicary10mo ago

NPM imports fail on JSON require

When importing modules via npm: protocol, the embedded esbuild will throw the following error if the module tries to require("package.json") .
Error: Build failed with 1 error:
../../../../../Library/Caches/deno/deno_esbuild/{module}@{version}/node_modules/{module}/package.json:2:8: ERROR: Expected ";" but found ":"
Error: Build failed with 1 error:
../../../../../Library/Caches/deno/deno_esbuild/{module}@{version}/node_modules/{module}/package.json:2:8: ERROR: Expected ";" but found ":"
In my case, the problematic module is checkout-sdk-node. Is there known workaround for this?
1 Reply
vicary
vicaryOP10mo ago
Turns out when a Fresh island shares the same file with NPM imports, it fails like that. It makes total sense when the cause is known, esbuild shouldn't understands require("package.json") when targeting the web. It would definitely saves me an hour or two with a better error message.