Skip to content

Commit

Permalink
feat: restore CommonJS bundle (#980)
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreen committed Dec 19, 2022
1 parent 4f39cdd commit 1eb1ba7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
7 changes: 4 additions & 3 deletions package.json
Expand Up @@ -42,8 +42,9 @@
"exports": "./src/index.ts",
"publishConfig": {
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
"require": "./dist/index.cjs"
},
"directory": "package"
},
Expand Down Expand Up @@ -71,7 +72,7 @@
"updateGitHooks": "simple-git-hooks"
},
"peerDependencies": {
"chart.js": "^4.0.0",
"chart.js": "^4.1.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"devDependencies": {
Expand All @@ -94,7 +95,7 @@
"@vue/eslint-config-typescript": "^11.0.0",
"@vue/test-utils": "^2.0.0-rc.17",
"browserslist": "^4.19.1",
"chart.js": "^4.0.0",
"chart.js": "^4.1.1",
"clean-publish": "^4.0.0",
"commitizen": "^4.2.4",
"cross-env": "^7.0.0",
Expand Down
14 changes: 10 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions rollup.config.js
Expand Up @@ -24,9 +24,16 @@ export default {
input: pkg.exports,
plugins: plugins('defaults and supports es6-module'),
external,
output: {
format: 'es',
file: pkg.publishConfig.exports.import,
sourcemap: true
}
output: [
{
file: pkg.publishConfig.exports.import,
format: 'es',
sourcemap: true
},
{
file: pkg.publishConfig.exports.require,
format: 'cjs',
sourcemap: true
}
]
}
10 changes: 8 additions & 2 deletions src/props.ts
@@ -1,13 +1,19 @@
import type { PropType } from 'vue'
import type { ChartType, ChartData, Plugin, UpdateMode } from 'chart.js'
import type {
ChartType,
ChartData,
ChartOptions,
Plugin,
UpdateMode
} from 'chart.js'

export const CommonProps = {
data: {
type: Object as PropType<ChartData>,
required: true
},
options: {
type: Object, // as PropType<ChartOptions>, restore after Chart.js update
type: Object as PropType<ChartOptions>,
default: () => ({})
},
plugins: {
Expand Down

0 comments on commit 1eb1ba7

Please sign in to comment.