Comparing version 3.4.0 to 3.4.1
@@ -100,3 +100,3 @@ #!/usr/bin/env node | ||
var version = "3.4.0"; | ||
var version = "3.4.1"; | ||
@@ -103,0 +103,0 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
@@ -668,13 +668,18 @@ Object.defineProperty(exports, '__esModule', { value: true }); | ||
const exportCond = exportPaths[entryExport]; | ||
const hasEdgeLight = !!exportCond['edge-light']; | ||
const hasReactServer = !!exportCond['react-server']; | ||
const buildConfigs = [ | ||
createBuildConfig('', exportCond) // default config | ||
]; | ||
if (hasEdgeLight) { | ||
buildConfigs.push(createBuildConfig('edge-light', exportCond)); | ||
// For dts job, only build the default config. | ||
// For assets job, build all configs. | ||
if (!dts) { | ||
if (exportCond['edge-light']) { | ||
buildConfigs.push(createBuildConfig('edge-light', exportCond)); | ||
} | ||
if (exportCond['react-server']) { | ||
buildConfigs.push(createBuildConfig('react-server', exportCond)); | ||
} | ||
if (exportCond['react-native']) { | ||
buildConfigs.push(createBuildConfig('react-native', exportCond)); | ||
} | ||
} | ||
if (hasReactServer) { | ||
buildConfigs.push(createBuildConfig('react-server', exportCond)); | ||
} | ||
function createBuildConfig(exportType, exportCondRef) { | ||
@@ -681,0 +686,0 @@ return _createBuildConfig.apply(this, arguments); |
{ | ||
"name": "bunchee", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "zero config bundler for js/ts/jsx libraries", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -64,4 +64,7 @@ # bunchee | ||
Then just run `npm run build`, or `pnpm build` / `yarn build` if you're using these package managers. | ||
Then just run `npm run build`, or `pnpm build` / `yarn build` if you're using these package managers. The output format will based on the exports condition and also the file extension. Given an example: | ||
* It's CommonJS for `require` and ESM for `import` based on the exports condition. | ||
* It's CommonJS for `.js` and ESM for `.mjs` based on the extension regardless the exports condition. Then for export condition like "node" you could choose the format with your extension. | ||
## Configuration | ||
@@ -125,3 +128,2 @@ | ||
### Entry Files Convention | ||
@@ -166,2 +168,31 @@ | ||
It will also look up for `index.<ext>` file under the directory having the name of the export path. For example, if you have `"./lite": "./dist/lite.js"` in exports field, then it will look up for `./lite/index.js` as the entry file as well. | ||
### Special Exports Conventions | ||
For exports condition like `react-native`, `react-server` and `edge-light` as they're special platforms, they could have different exports or different code conditions. In this case bunchee provides an override input source file convention if you want to build them as different code bundle. | ||
For instance: | ||
```json | ||
{ | ||
"exports": { | ||
"react-server": "./dist/react-server.mjs", | ||
"edge-light": "./dist/edge-light.mjs", | ||
"import": "./dist/index.mjs" | ||
} | ||
} | ||
``` | ||
You can use `index.<export-type>.<ext>` to override the input source file for specific export name. Or using `<export-path>/index.<export-type>.<ext>` also works. Such as: | ||
``` | ||
|- src/ | ||
|- index/.ts | ||
|- index.react-server.ts | ||
|- index.edge-light.ts | ||
``` | ||
This will match the export name `"react-server"` and `"edge-light"` then use the corresponding input source file to build the bundle. | ||
#### Package lint | ||
@@ -168,0 +199,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57769
1343
251