Skip to content

Commit 2c3cae8

Browse files
committed
build: Convert module build output to CommonJS (cjs) and ECMAScript module (mjs) files
1 parent c7579ba commit 2c3cae8

File tree

5 files changed

+1611
-3148
lines changed

5 files changed

+1611
-3148
lines changed

build/index.js

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
1-
const path = require('path')
21
const esbuild = require('esbuild')
3-
const { dtsPlugin } = require('esbuild-plugin-d.ts')
42

53
const common = {
64
target: 'esnext',
7-
plugins: [
8-
dtsPlugin()
9-
]
10-
}
11-
12-
esbuild.build({
13-
...common,
145
entryPoints: [
156
{ in: 'src/index.ts', out: 'index' },
167
{ in: 'src/Helpers/VertexEncoder.ts', out: 'Helpers/VertexEncoder' }
178
],
18-
outdir: 'dist/cjs',
9+
bundle: true
10+
}
11+
12+
esbuild.build({
13+
...common,
1914
format: 'cjs',
20-
bundle: true,
15+
outdir: 'dist/cjs',
16+
outExtension: {
17+
'.js': '.cjs'
18+
}
2119
})
2220

2321
esbuild.build({
2422
...common,
25-
entryPoints: [
26-
{ in: 'src/index.ts', out: 'index' },
27-
{ in: 'src/Helpers/VertexEncoder.ts', out: 'Helpers/VertexEncoder' },
28-
],
29-
outdir: 'dist/esm',
3023
format: 'esm',
31-
bundle: true,
24+
outdir: 'dist/esm',
25+
outExtension: {
26+
'.js': '.mjs'
27+
}
3228
})

0 commit comments

Comments
 (0)