Skip to content

Commit

Permalink
Merge pull request #428 from thornbill/optimize-rollup
Browse files Browse the repository at this point in the history
Use preserveModules in rollup build
  • Loading branch information
thornbill authored Mar 23, 2023
2 parents 32294f5 + 2ffeef4 commit 79b2839
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -21,7 +23,9 @@ export default {
),
output: {
dir: 'lib',
format: 'es'
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src'
},
external: [
'axios',
Expand Down

0 comments on commit 79b2839

Please sign in to comment.