Skip to content

Commit 59fe639

Browse files
committed
[feature/2.0.0] rollup typescript setting add
1 parent f7a4cc8 commit 59fe639

File tree

4 files changed

+201
-6
lines changed

4 files changed

+201
-6
lines changed

package-lock.json

+158-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"example": "webpack-dev-server --inline --mode development",
88
"build": "rollup -c",
9-
"build:watch": "rollup -c --watch"
9+
"build:watch": "rollup -c --watch",
10+
"prebuild": "rm -rf dist"
1011
},
1112
"keywords": [
1213
"reactjs",
@@ -59,6 +60,7 @@
5960
"rollup": "^2.26.5",
6061
"rollup-plugin-babel": "^4.4.0",
6162
"rollup-plugin-img": "^1.1.0",
63+
"rollup-plugin-typescript2": "^0.27.2",
6264
"typescript": "^4.0.2",
6365
"webpack": "^4.44.1",
6466
"webpack-cli": "^3.3.12",

rollup.config.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
import babel from "rollup-plugin-babel";
22
import image from "rollup-plugin-img";
3+
import typescript from 'rollup-plugin-typescript2';
34
import pkg from "./package.json";
45

56
const external = id => !id.startsWith("/") && !id.startsWith(".");
67

78
export default {
8-
input: "./src/ImageSlider.jsx",
9+
input: "src/index.ts",
910
output: {
1011
file: pkg.main,
11-
format: "cjs",
12+
format: "esm",
1213
},
1314
plugins: [
1415
babel({ runtimeHelpers: true }),
1516
image({ limit: 1000 }),
17+
typescript({
18+
tsconfig: 'tsconfig.json',
19+
tsconfigOverride: {
20+
include: [ 'src/**/*' ],
21+
exclude: [ 'node_modules', 'example' ]
22+
}
23+
})
1624
],
1725
external,
1826
};

tsconfig.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"compilerOptions": {
3+
"declaration": true,
4+
"declarationDir": "./dist",
5+
"target": "ESNext",
6+
"module": "ESNext",
7+
"moduleResolution": "node",
8+
"esModuleInterop": true,
9+
"sourceMap": true,
10+
"noImplicitAny": true,
11+
"noImplicitThis": true,
12+
"alwaysStrict": true,
13+
"strictNullChecks": true,
14+
"strictPropertyInitialization": true,
15+
"noImplicitReturns": true,
16+
"noUnusedParameters": true,
17+
"allowSyntheticDefaultImports": true,
18+
19+
"jsx": "react",
20+
"types": ["react"],
21+
"outDir": "dist"
22+
},
23+
"include": [
24+
"src/**/*",
25+
"example/*"
26+
],
27+
"exclude": [
28+
"node_modules"
29+
]
30+
}

0 commit comments

Comments
 (0)