Skip to content

Commit 9490fdf

Browse files
authored
chore: add rollup-plugin-dts for nodenext compat (#614)
merged! thanks
1 parent 97fbe71 commit 9490fdf

3 files changed

Lines changed: 67 additions & 21 deletions

File tree

package-lock.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
"version": "0.0.0-semantic-release",
44
"author": "Yomotsu",
55
"license": "MIT",
6+
"type": "module",
67
"main": "dist/camera-controls.cjs",
78
"module": "dist/camera-controls.module.js",
89
"types": "dist/index.d.ts",
10+
"exports": {
11+
".": {
12+
"types": "./dist/index.d.ts",
13+
"import": "./dist/camera-controls.module.js",
14+
"require": "./dist/camera-controls.cjs"
15+
}
16+
},
917
"files": [
1018
"dist"
1119
],
@@ -26,6 +34,7 @@
2634
"npm-run-all": "^4.1.5",
2735
"open-cli": "^8.0.0",
2836
"rollup": "^4.45.0",
37+
"rollup-plugin-dts": "^6.2.3",
2938
"semantic-release": "^24.2.7",
3039
"serve": "^14.2.4",
3140
"terser": "^5.43.1",

rollup.config.mjs

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import rollupReplace from '@rollup/plugin-replace';
22
import rollupTypescript from '@rollup/plugin-typescript';
3+
import dts from 'rollup-plugin-dts';
34
import typescript from 'typescript';
45
import { createRequire } from 'module';
56
const require = createRequire(import.meta.url);
@@ -12,26 +13,38 @@ const license = `/*!
1213
* Released under the MIT License.
1314
*/`;
1415

15-
export default {
16-
input: 'src/index.ts',
17-
output: [
18-
{
16+
export default [
17+
{
18+
input: 'src/index.ts',
19+
output: [
20+
{
21+
format: 'es',
22+
file: pkg.module,
23+
banner: license,
24+
indent: '\t',
25+
exports: 'named',
26+
},
27+
{
28+
format: 'cjs',
29+
file: pkg.main,
30+
banner: license,
31+
indent: '\t',
32+
exports: 'named',
33+
}
34+
],
35+
plugins: [
36+
rollupReplace( { preventAssignment: true, __VERSION: pkg.version } ),
37+
rollupTypescript( { typescript, declaration: false } ),
38+
],
39+
},
40+
{
41+
input: 'src/index.ts',
42+
output: {
43+
file: pkg.types,
1944
format: 'es',
20-
file: pkg.module,
21-
banner: license,
22-
indent: '\t',
23-
exports: 'named',
2445
},
25-
{
26-
format: 'cjs',
27-
file: pkg.main,
28-
banner: license,
29-
indent: '\t',
30-
exports: 'named',
31-
}
32-
],
33-
plugins: [
34-
rollupReplace( { preventAssignment: true, __VERSION: pkg.version } ),
35-
rollupTypescript( { typescript } ),
36-
],
37-
};
46+
plugins: [
47+
dts( { compilerOptions: { preserveSymlinks: false } } ),
48+
],
49+
}
50+
];

0 commit comments

Comments
 (0)