({ pkg, external = [] })
| 10 | * @returns {import('rollup').RollupOptions} |
| 11 | */ |
| 12 | export function createConfig({ pkg, external = [] }) { |
| 13 | return { |
| 14 | input: 'src/index.ts', |
| 15 | external: Object.keys(pkg.dependencies || {}) |
| 16 | .concat(Object.keys(pkg.peerDependencies || {})) |
| 17 | .concat(builtinModules) |
| 18 | .concat(external), |
| 19 | onwarn: (warning) => { |
| 20 | throw Object.assign(new Error(), warning); |
| 21 | }, |
| 22 | strictDeprecations: true, |
| 23 | output: [ |
| 24 | { |
| 25 | format: 'cjs', |
| 26 | file: pkg.main, |
| 27 | exports: 'named', |
| 28 | footer: 'module.exports = Object.assign(exports.default, exports);', |
| 29 | sourcemap: true |
| 30 | }, |
| 31 | { |
| 32 | format: 'es', |
| 33 | file: pkg.module, |
| 34 | plugins: [emitModulePackageFile()], |
| 35 | sourcemap: true |
| 36 | } |
| 37 | ], |
| 38 | plugins: [typescript({ sourceMap: true })] |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | export function emitModulePackageFile() { |
| 43 | return { |
no test coverage detected