Skip to content

Commit 1eb1ba7

Browse files
authored
feat: restore CommonJS bundle (#980)
1 parent 4f39cdd commit 1eb1ba7

File tree

4 files changed

+34
-14
lines changed

4 files changed

+34
-14
lines changed

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
"exports": "./src/index.ts",
4343
"publishConfig": {
4444
"exports": {
45+
"types": "./dist/index.d.ts",
4546
"import": "./dist/index.js",
46-
"types": "./dist/index.d.ts"
47+
"require": "./dist/index.cjs"
4748
},
4849
"directory": "package"
4950
},
@@ -71,7 +72,7 @@
7172
"updateGitHooks": "simple-git-hooks"
7273
},
7374
"peerDependencies": {
74-
"chart.js": "^4.0.0",
75+
"chart.js": "^4.1.1",
7576
"vue": "^3.0.0-0 || ^2.6.0"
7677
},
7778
"devDependencies": {
@@ -94,7 +95,7 @@
9495
"@vue/eslint-config-typescript": "^11.0.0",
9596
"@vue/test-utils": "^2.0.0-rc.17",
9697
"browserslist": "^4.19.1",
97-
"chart.js": "^4.0.0",
98+
"chart.js": "^4.1.1",
9899
"clean-publish": "^4.0.0",
99100
"commitizen": "^4.2.4",
100101
"cross-env": "^7.0.0",

pnpm-lock.yaml

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

rollup.config.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ export default {
2424
input: pkg.exports,
2525
plugins: plugins('defaults and supports es6-module'),
2626
external,
27-
output: {
28-
format: 'es',
29-
file: pkg.publishConfig.exports.import,
30-
sourcemap: true
31-
}
27+
output: [
28+
{
29+
file: pkg.publishConfig.exports.import,
30+
format: 'es',
31+
sourcemap: true
32+
},
33+
{
34+
file: pkg.publishConfig.exports.require,
35+
format: 'cjs',
36+
sourcemap: true
37+
}
38+
]
3239
}

src/props.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import type { PropType } from 'vue'
2-
import type { ChartType, ChartData, Plugin, UpdateMode } from 'chart.js'
2+
import type {
3+
ChartType,
4+
ChartData,
5+
ChartOptions,
6+
Plugin,
7+
UpdateMode
8+
} from 'chart.js'
39

410
export const CommonProps = {
511
data: {
612
type: Object as PropType<ChartData>,
713
required: true
814
},
915
options: {
10-
type: Object, // as PropType<ChartOptions>, restore after Chart.js update
16+
type: Object as PropType<ChartOptions>,
1117
default: () => ({})
1218
},
1319
plugins: {

0 commit comments

Comments
 (0)