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

Adds support for ES6 modules #6619

Merged
merged 1 commit into from
Oct 27, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"jsdelivr": "dist/Chart.min.js",
"unpkg": "dist/Chart.min.js",
"main": "dist/Chart.js",
"module": "dist/Chart.esm.js",
"keywords": [
"canvas",
"charts",
Expand Down
105 changes: 105 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,66 @@ const banner = `/*!
*/`;

module.exports = [
// ES6 builds (excluding moment)
// dist/Chart.esm.min.js
// dist/Chart.esm.js
{
input: input,
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
stylesheet({
extract: true
}),
],
output: {
name: 'Chart',
file: 'dist/Chart.esm.js',
banner: banner,
format: 'esm',
indent: false,
globals: {
moment: 'moment'
}
},
external: [
'moment'
]
},
{
input: input,
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
stylesheet({
extract: true,
minify: true
}),
terser({
output: {
preamble: banner
}
})
],
output: {
name: 'Chart',
file: 'dist/Chart.esm.min.js',
format: 'esm',
indent: false,
globals: {
moment: 'moment'
}
},
external: [
'moment'
]
},
// UMD builds (excluding moment)
// dist/Chart.min.js
// dist/Chart.js
Expand Down Expand Up @@ -84,6 +144,51 @@ module.exports = [
]
},

// ES6 builds (including moment)
// dist/Chart.bundle.esm.min.js
// dist/Chart.bundle.esm.js
{
input: input,
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
stylesheet()
],
output: {
name: 'Chart',
file: 'dist/Chart.bundle.esm.js',
banner: banner,
format: 'esm',
indent: false
}
},
{
input: input,
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
stylesheet({
minify: true
}),
terser({
output: {
preamble: banner
}
})
],
output: {
name: 'Chart',
file: 'dist/Chart.bundle.esm.min.js',
format: 'esm',
indent: false
}
},
// UMD builds (including moment)
// dist/Chart.bundle.min.js
// dist/Chart.bundle.js
Expand Down