bundlephobia icon indicating copy to clipboard operation
bundlephobia copied to clipboard

postcss: empty "Exports Analysis"

Open Semigradsky opened this issue 5 years ago • 6 comments

https://bundlephobia.com/[email protected]

It said that This package does not export ES6 modules. But it does: https://github.com/postcss/postcss/blob/d43308c513a848b663b83aecaf75abeb65ba9cb0/package.json#L11

https://nodejs.org/api/packages.html#packages_conditional_exports

Semigradsky avatar Jan 09 '21 12:01 Semigradsky

Same with ky:

  • https://github.com/sindresorhus/ky/blob/4fc06d9cd22290d68c5d432c8ed53f92960985f9/package.json#L13
  • https://bundlephobia.com/[email protected]

sindresorhus avatar Jan 13 '21 13:01 sindresorhus

Also, this: https://bundlephobia.com/[email protected]

I debugged every API and everything is working fine. Strange that it stopped working.

API:

  • https://bundlephobia.com/api/size?package=common-tags
  • https://bundlephobia.com/api/exports?package=common-tags
  • https://bundlephobia.com/api/exports-sizes?package=common-tags

astoilkov avatar Jan 21 '21 18:01 astoilkov

@sindresorhus Your module doesn't work for another reason. The API https://bundlephobia.com/api/[email protected] returns hasJSModule: false because if you look at the code it checks the existence of module field in the package.json: https://github.com/pastelsky/package-build-stats/blob/master/src/getPackageStats.ts#L29

BTW, this behavior is strange.

P.S. Good luck with The ESM Move. Inspired by you I started working on it as well.

astoilkov avatar Jan 21 '21 18:01 astoilkov

I found out more about this issue. It seems the module field points to a directory that is written with ESM. However, my repo code is inside the root directory and I don't have any idea what to set as a value for module.

Things I tried but didn't work:

  • "module": "" (Bundle Phobia doesn't recognize it as ES module)
  • "module": "." (causes a Build Error)

The different versions are here: https://github.com/astoilkov/use-local-storage-state/releases. You can experiment with them by growing Bundle Phobia.

astoilkov avatar Jan 21 '21 21:01 astoilkov

Sorry but I haven't found the time to read through type: module and exports specifications. This plus the mjs stuff just makes it very complicated for tools that have to support both module resolution mechanisms. Could someone here who understand this better than me summarize what a tool like bundlephobia would have to do to —

  1. Recognize reliably that for packages using exports, if an ESM version is shipped.
  2. Be able to refer to the right export path for deriving named exports etc (looks like an upgrade to Webpack 5 will be a necessity)

I'm not sure I'd want bundlephobia to switch to Webpack 5 yet, as it appears that the ecosystem around Webpack 5 isn't mature. For eg. there is still no stable version of Webpack Dev Server that works with Webpack 5 (so many months after W5 release).

pastelsky avatar Jan 24 '21 08:01 pastelsky

Webpack 5 is probably mature 4 years later now, right?

dynst avatar Oct 31 '25 23:10 dynst