Comments (6)
@wespickett This is true for:
[
{
"format": "esm"
},
{
"format": "lib"
}
]
But not:
{
"format": ["esm", "lib"]
}
But regardless, exports are deep-merged from all artifacts.
from packemon.
https://github.com/wespickett/packemon-test1
Steps:
npm install
cd packages/example1
npm run build
Expected:
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"types": "./esm/index.d.ts",
"module": "./esm/index.js",
"import": "./esm/index.js",
"default": "./lib/index.js" <==== This is missing
},
"node": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"default": "./lib/index.js"
}
}
Actual:
"exports": {
"./package.json": "./package.json",
".": {
"browser": {
"types": "./esm/index.d.ts",
"module": "./esm/index.js",
"import": "./esm/index.js"
},
"node": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"default": "./lib/index.js"
}
}
from packemon.
@wespickett That's unfortunately correct... lib
is configured for node
, and shouldn't appear under browser
.
Are you actually having issues with this? browser
is used by bundlers, nothing else, and would either use require/import anyways.
from packemon.
@milesj yes, the issue is happening with jest, since we have 'browser' in the conditions list in the config. The previously published version of the packages (using packemon 2.x) do have the exports[path].browser.default key setup correctly, so this appears to be a regression
from packemon.
@wespickett v2 was actually wrong IMO.
Is browser really required in Jest? Browser is almost always ESM code, which isn't compatible with Jest. I always configure Jest to use node/cjs.
from packemon.
Removed the browser condition, and also changed the packemon configs to be ["esm", "lib"] for the browser platforms so the cjs code is generated for the defaults
from packemon.
Related Issues (20)
- `packemon build` doc is outdated? HOT 1
- `packemon build` set the wrong `main` field HOT 3
- Unable to use `PackageValidator` for non-packemon packages HOT 2
- Bug: `transform-react-jsx currently only accepts useBuiltIns or useSpread but not both` HOT 1
- Bug: subpaths for `lib` format are not generated properly HOT 5
- Bug: Assets are not being bundled properly when using esm bundle format HOT 7
- Bug: `native` platform exports are pointing to the incorrect files when also building `node` HOT 5
- Bug: types not added to export map for tsx input files HOT 3
- .packemon.js config file naming no longer supported HOT 2
- Transpile without rolling up to index.js HOT 2
- ENOENT: no such file or directory, open /apps/web/package.json' HOT 1
- Add option for babelHelpers to be runtime instead of bundled HOT 2
- TypeScript library with `"type": "module"` generating `cjs` declarations with `.d.ts` suffix HOT 6
- Babel Error: `@babel/plugin-proposal-private-property-in-object ` explicit dependency HOT 5
- any way to add rollup plugins? HOT 2
- Sourcemaps don't seem to be generated correctly
- clean command is not working HOT 1
- "helpers" feature not removing babelHelpers HOT 2
- [Docs] Meaning of directory name colors of `npx packemon files` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from packemon.