Skip to content

correctly create csj and esm build#55

Open
engbergandreas wants to merge 4 commits into
masterfrom
feature/esm-cjs-build
Open

correctly create csj and esm build#55
engbergandreas wants to merge 4 commits into
masterfrom
feature/esm-cjs-build

Conversation

@engbergandreas

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the build/publish configuration to produce separate CommonJS and ES module outputs and wires package.json entry points to the new dist/cjs and dist/esm layout.

Changes:

  • Split TypeScript outputs into dist/cjs (CJS + declarations) and dist/esm (ESM + declarations).
  • Add a dedicated tsconfig.esm.json and update the build script to run both TS builds.
  • Update package.json main/types/exports to point at the new per-module output directories.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
tsconfig.rollup.json Adjusts Rollup TS compilation output directory for the IIFE build.
tsconfig.json Moves the default TS build output to dist/cjs (including declarations).
tsconfig.esm.json Introduces a separate TS config for emitting ESM to dist/esm.
package.json Updates entry points/conditional exports and build script for dual CJS+ESM publishing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
Comment on lines 11 to +16
".": {
"types": "./dist/node.d.ts",
"import": "./dist/node.js",
"require": "./dist/node.js",
"browser": "./dist/browser.js",
"default": "./dist/node.js"
"browser": "./dist/esm/browser.js",
"import": "./dist/esm/node.js",
"require": "./dist/cjs/node.js",
"types": "./dist/cjs/node.d.ts",
"default": "./dist/cjs/node.js"
Comment thread tsconfig.rollup.json
Comment on lines 3 to 7
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler"
"moduleResolution": "bundler",
"outDir": "./dist"
}
Comment thread tsconfig.esm.json
Comment on lines +3 to +8
"compilerOptions": {
"module": "esnext",
"moduleResolution": "bundler",
"outDir": "./dist/esm",
"declarationDir": "./dist/esm"
}

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Comment thread package.json
Comment on lines 10 to 17
"exports": {
".": {
"types": "./dist/node.d.ts",
"import": "./dist/node.js",
"require": "./dist/node.js",
"browser": "./dist/browser.js",
"default": "./dist/node.js"
"browser": "./dist/esm/browser.js",
"import": "./dist/esm/node.js",
"require": "./dist/cjs/node.js",
"types": "./dist/cjs/node.d.ts",
"default": "./dist/cjs/node.js"
},
Comment thread tsconfig.esm.json
Comment on lines +4 to +8
"module": "esnext",
"moduleResolution": "bundler",
"declaration": true,
"outDir": "./dist/esm",
"declarationDir": "./dist/esm"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants