Closed mationai closed 3 years ago
Sorry, I'm not interested in changing my package to please bundlers. This should be properly fixed in Rollup instead.
It's not just Rollup, others will complain about it too since it's not properly configured, please see https://nodejs.org/api/packages.html#packages_package_entry_points
I disagree with your assessment that it's not properly configured. Previously, package consumers could import any subpath from a package, making it possible for consumers to import internal modules, etc. Now, we explicitly export what's public. I don't think every package should have to export their package.json. That's just a losing battle for bundlers. They should instead directly read the package.json file using the fs
methods. That way it will work for any package. Please do open an issue on your bundler about this.
Appreciate your reasoning for the close.
Package.json should export itself has well as the js file. Without it, bundlers such as rollup will complain about it, see eg. below. This PR fixes it by exporting both.
Eg.: [rollup-plugin-svelte] The following packages did not export their
package.json
file so we could not check the "svelte" field. If you had difficulties importing svelte components from a package, then please contact the author and ask them to export the package.json file.