Skip to content

Commit

Permalink
chore: improve package exports
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinH committed Apr 3, 2024
1 parent b6dac9c commit 2940c18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bili.config.ts
Expand Up @@ -23,7 +23,7 @@ const config: Config = {
config.output.fileName = 'umd/react-easy-crop[min].js'
}
if (format === 'esm') {
config.output.fileName = '[name].module.js'
config.output.fileName = '[name].module.mjs'
}
return config
},
Expand Down
19 changes: 10 additions & 9 deletions scripts/copy-build-files.js
Expand Up @@ -17,18 +17,18 @@ async function createPackageFile() {
jest: undefined,
'lint-staged': undefined,
main: './index.js',
'umd:main': './umd/react-easy-crop.js',
unpkg: './umd/react-easy-crop.js',
jsdelivr: './umd/react-easy-crop.js',
module: './index.module.js',
'jsnext:main': './index.module.js',
'react-native': './index.module.js',
module: './index.module.mjs',
types: './index.d.ts',
exports: {
'.': {
import: './index.module.js',
require: './index.js',
types: './index.d.ts',
import: {
types: './index.d.ts',
default: './index.module.mjs',
},
require: {
types: './index.d.ts',
default: './index.js',
},
},
'./react-easy-crop.css': {
import: './react-easy-crop.css',
Expand All @@ -50,6 +50,7 @@ async function run() {
{ from: './README.md' },
{ from: './LICENSE' },
{ from: './src/styles.css', to: 'react-easy-crop.css' },
{ from: './dist/index.d.ts', to: './dist/index.module.d.mts' },
].map((file) => copyFile(file))
)
await createPackageFile()
Expand Down

0 comments on commit 2940c18

Please sign in to comment.