Merge pull request #428 from thornbill/optimize-rollup

Use preserveModules in rollup build
This commit is contained in:
Bill Thornton 2023-03-23 17:07:27 -04:00 committed by GitHub
commit 79b28397ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,12 @@ import { fileURLToPath } from 'node:url';
import typescript from '@rollup/plugin-typescript';
import { glob } from 'glob';
/** @type {import('rollup').RollupOptions} */
export default {
// This is adapted from the sample config: https://www.rollupjs.org/configuration-options/#input
input: Object.fromEntries(
glob.sync('src/**/*.ts', { ignore: 'src/**/__{helpers,tests}__/*' }).map(file => [
// Only looking for index files since they should be the only entry points
glob.sync('src/**/index.ts', { ignore: 'src/**/__{helpers,tests}__/*' }).map(file => [
// This remove `src/` as well as the file extension from each
// file, so e.g. src/nested/foo.js becomes nested/foo
path.relative(
@ -21,7 +23,9 @@ export default {
),
output: {
dir: 'lib',
format: 'es'
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src'
},
external: [
'axios',