Closed Olian04 closed 1 year ago
Hi, did investigate of this error and figure out it generates in webpack's enhanced-resolve
module, with message below
Package path . is not exported from package /tmp/tmp-build/packages/build-xml-template-literal-eih/node_modules/xml-template-literal (see exports field in /tmp/tmp-build/packages/build-xml-template-literal-eih/node_modules/xml-template-literal/package.json)
Probably problem in export
field in xml-template-literal
package.json file. Here found some good describe of example with this problem
In my opinion, have two options to resolve:
conditionNames
param to package-build-stats
pack (where placed enhanced-resolve
)default
field inside exports field, for ex:
"exports": {
"import": "./dist/api.js",
"require": "./legacy/umd.cjs",
"types": "./dist/api.d.ts",
"default": "./dist/api.js"
},
Think second option faster, but mb it's some common case and need to improve package-build-stats
config, but with this point maybe @pastelsky will help, because I may not know some details
How did you get visibility of the underlying error? I'm facing an anonymous BuildError Failed to build this package.
https://bundlephobia.com/package/@watchable/store@0.9.0-alpha.2 which I'm happy to pursue further but not sure how I can see it failing on my machine as you did. Maybe i need "types"
and "default"
when I currently have just "import" and "require" but without being able to run the build procedure it's hard to tell.
@cefn I've run project and checked error middleware. I see the same error with your package Package path . is not exported from...
You can check how it resolved with enhanced-resolve
separately from bundlephobia, using only this module, for example, and test directly your module
Hi, did investigate of this error and figure out it generates in webpack's
enhanced-resolve
module, with message belowPackage path . is not exported from package /tmp/tmp-build/packages/build-xml-template-literal-eih/node_modules/xml-template-literal (see exports field in /tmp/tmp-build/packages/build-xml-template-literal-eih/node_modules/xml-template-literal/package.json)
Probably problem in
export
field inxml-template-literal
package.json file. Here found some good describe of example with this problem In my opinion, have two options to resolve:
- add
conditionNames
param topackage-build-stats
pack (where placedenhanced-resolve
)- add to xml-template-literal
default
field inside exports field, for ex:"exports": { "import": "./dist/api.js", "require": "./legacy/umd.cjs", "types": "./dist/api.d.ts", "default": "./dist/api.js" },
Think second option faster, but mb it's some common case and need to improve
package-build-stats
config, but with this point maybe @pastelsky will help, because I may not know some details
Thank you @upteran. This seems to have resolved the build error. However the "Exports Analysis" remains empty. It just says "GZIP sizes of individual exports".
@cefn I've run project and checked error middleware.
Thanks for your clear description of how to recreate the resolution issue we are experiencing! For the @watchable/store project I was able to fix it for https://bundlephobia.com/package/@watchable/store@0.9.0-alpha.3 by adding a "default"
field to "exports"
in the package.json
in https://github.com/cefn/watchable/commit/e17c03ea80c917b1f93a3e25473925b63e8defd2
@Olian04 Maybe the problem is in the setting of the default
field. I've seen in your last version exported .cjs
bundle by default. But in the field type: "module"
you tell that your package uses ES modules. And maybe it is confusing on analyzing because if I do not mistake it works with ES modules only and type gives this info, that's why no error, but default commonjs bundle gives an empty "Exports Analysis"
try to export by default ES modules, maybe it can help
@upteran that resolves it. Thank you.
Package name
Entire (stringified) error that I see in my browser console