diff --git a/package.json b/package.json index 0ee01277..4af547d9 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/vite.config.ts b/vite.config.ts index 5109d20e..b02384b4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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)],