You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
869 B
36 lines
869 B
import {terser} from "rollup-plugin-terser"; |
|
import * as meta from "./package.json"; |
|
|
|
const config = { |
|
input: "src/index.js", |
|
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), |
|
output: { |
|
file: `dist/${meta.name}.js`, |
|
name: "d3", |
|
format: "umd", |
|
indent: false, |
|
extend: true, |
|
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, |
|
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) |
|
}, |
|
plugins: [] |
|
}; |
|
|
|
export default [ |
|
config, |
|
{ |
|
...config, |
|
output: { |
|
...config.output, |
|
file: `dist/${meta.name}.min.js` |
|
}, |
|
plugins: [ |
|
...config.plugins, |
|
terser({ |
|
output: { |
|
preamble: config.output.banner |
|
} |
|
}) |
|
] |
|
} |
|
];
|
|
|