Skip to content

Commit

Permalink
Merge pull request #40 from PhillipsAuctionHouse/change-build
Browse files Browse the repository at this point in the history
Add commonjs build to our package
  • Loading branch information
davidicus authored Jan 18, 2024
2 parents ca969e8 + a914808 commit 3a4b630
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@phillips/seldon",
"version": "1.8.0",
"type": "module",
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand Down
14 changes: 12 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,28 @@ export default defineConfig({
// Could also be a dictionary or array of multiple entry points
entry: ['index.ts'],
name: 'seldon',
formats: ['es'],
formats: ['es', 'cjs'],
},

rollupOptions: {
input: 'src/index.ts',
output: {
output: [
{
dir: 'dist',
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src',
chunkFileNames: '[name].js',
entryFileNames: '[name].js',
},
{
dir: 'dist',
format: 'cjs',
preserveModulesRoot: 'src',
chunkFileNames: '[name].cjs',
entryFileNames: '[name].cjs',
},
],
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [...Object.keys(packageJson.peerDependencies)],
Expand Down

0 comments on commit 3a4b630

Please sign in to comment.