Skip to content

Commit 6a76382

Browse files
committed
update build
1 parent 47d8999 commit 6a76382

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

packages/config/src/tsup/config.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ const { defineConfig } = require('tsup')
22

33
module.exports = defineConfig(() => ({
44
entry: ['src/index.ts'],
5-
format: ['esm', 'cjs'],
5+
format: ['esm', 'cjs'], // Output both ESM and CJS formats
66
dts: {
77
resolve: true,
88
entry: 'src/index.ts',
99
},
10-
outDir: 'dist',
1110
clean: true,
11+
esbuildOptions(options, context) {
12+
if (context.format === 'esm') {
13+
options.outdir = 'dist/esm' // Output ESM files to dist/esm
14+
options.outExtension = { '.js': '.mjs' } // Use .mjs for ESM files
15+
} else if (context.format === 'cjs') {
16+
options.outdir = 'dist/cjs' // Output CJS files to dist/cjs
17+
}
18+
},
1219
}))

packages/page-tools/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"directory": "packages/page-tools"
88
},
99
"license": "MIT",
10-
"module": "./dist/index.mjs",
11-
"types": "./dist/index.d.mts",
12-
"main": "./dist/index.js",
10+
"module": "./dist/esm/index.mjs",
11+
"main": "./dist/cjs/index.js",
12+
"types": "./dist/index.d.ts",
1313
"sideEffects": false,
1414
"files": [
1515
"LICENSE",

playgrounds/standalone-playground/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"scripts": {
88
".": "yarn run -T turbo run --filter=@playground/standalone-playground...",
99
"start": "yarn http-server . -o /pages",
10-
"dev": "yarn concurrently 'yarn start' 'sleep 3 && ASSET_PATH='/node_modules/@segment/analytics-next/dist/umd/' yarn . watch'",
10+
"dev": "yarn concurrently 'yarn start' 'yarn watch'",
11+
"watch": "yarn concurrently 'yarn:watch:*'",
12+
"watch:ajs": "ASSET_PATH='/node_modules/@segment/analytics-next/dist/umd/' yarn workspace @segment/analytics-next watch",
13+
"watch:signals": "yarn workspace @segment/analytics-signals watch",
1114
"concurrently": "yarn run -T concurrently"
1215
},
1316
"dependencies": {

0 commit comments

Comments
 (0)