Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: restore CommonJS bundle #980

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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