skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

skypack does not select the browser build of a package, goes for node one instead #160

Open panva opened 3 years ago

panva commented 3 years ago

Cheers! Wanted to give skypack a try but it failed on me on the very first try.

I've tried loading my isomorphic/universal package jose. Specifically one of its exports, e.g. https://cdn.skypack.dev/jose/jwk/parse.

Details ``` /* * [Package Error] "jose@v3.11.3" could not be built. * * [1/5] Verifying package is valid… * [2/5] Installing dependencies from npm… * [3/5] Building package using esinstall… * Running esinstall... * @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`. * Failed to load node_modules/jose/dist/node/esm/runtime/zlib.js * 'promisify' is not exported by node_modules/rollup-plugin-node-polyfills/polyfills/util.js, imported by ..jose/dist/node/esm/runtime/zlib.js * Install failed. * Install failed. * * How to fix: * - If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues * - If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix. * - Use https://skypack.dev/ to find a web-friendly alternative to find another package. */ console.warn("[Package Error] \"jose@v3.11.3\" could not be built. \n[1/5] Verifying package is valid…\n[2/5] Installing dependencies from npm…\n[3/5] Building package using esinstall…\nRunning esinstall...\n@rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.\nFailed to load node_modules/jose/dist/node/esm/runtime/zlib.js\n 'promisify' is not exported by node_modules/rollup-plugin-node-polyfills/polyfills/util.js, imported by ..jose/dist/node/esm/runtime/zlib.js\nInstall failed.\nInstall failed."); throw new Error("[Package Error] \"jose@v3.11.3\" could not be built. "); export default null; ```

The export in question does have a browser specific dist prepared and yet skypack went for the require one...

wlib commented 3 years ago

I'm having a similar issue where I import a file with complete browser compatibility but I get an error because one of the package's exports imports fs/promises