Skip to content

Commit

Permalink
Merge pull request #61 from nbudin/exports
Browse files Browse the repository at this point in the history
Add an exports field to package.json
  • Loading branch information
nbudin authored Feb 23, 2025
2 parents 34a494a + 7106dd7 commit 6c7cba6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
"dist"
],
"type": "module",
"exports": {
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"scripts": {
"build": "vite build && tsc --declaration --outDir dist/ --emitDeclarationOnly --declarationMap",
"prepublishOnly": "yarn run build",
Expand Down
7 changes: 6 additions & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ import tsconfigPaths from 'vite-tsconfig-paths';
import dts from 'vite-plugin-dts';

export default defineConfig({
plugins: [react(), tsconfigPaths(), dts({ insertTypesEntry: true })],
plugins: [
react(),
tsconfigPaths(),
dts({ insertTypesEntry: true, exclude: ['./dist', './lib', './test', './ModalTester.tsx'] }),
],
build: {
lib: {
entry: 'src/index.ts',
name: 'ReactBootstrap4Modal',
fileName: 'index',
formats: ['es', 'cjs'],
},
sourcemap: true,
rollupOptions: {
Expand Down

0 comments on commit 6c7cba6

Please sign in to comment.