Skip to content

Commit

Permalink
Add CJS support (#44)
Browse files Browse the repository at this point in the history
Updated build workflow to generate CJS (CommonJS) files as well as ESM
(ECMAScriptModule).
This resolves #43.
  • Loading branch information
friedemannsommer authored Nov 13, 2023
2 parents 24d79b9 + a05fa34 commit 0ab9e75
Show file tree
Hide file tree
Showing 5 changed files with 2,053 additions and 175 deletions.
33 changes: 33 additions & 0 deletions build.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
clean: true,
declaration: true,
entries: [
'./src/index.ts',
'./src/constants.ts',
'./src/lib/field-variant.ts',
'./src/parser.ts',
'./src/promise/index.ts',
'./src/stream/index.ts'
],
outDir: 'dist',
rollup: {
emitCJS: true,
esbuild: {
// reduce the overall package size by minifying the generated code.
// this isn't a "perfect" solution,
// but unless someone really wants to see the actual code
// (which they can by simply visiting GitHub),
// this will save roughly 20%.
minify: true,
platform: 'neutral',
target: 'node16',
treeShaking: true
},
output: {
exports: 'named',
generatedCode: 'es2015'
}
}
})
15 changes: 0 additions & 15 deletions build.tsconfig.json

This file was deleted.

Loading

0 comments on commit 0ab9e75

Please sign in to comment.