-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathrollup.npm.config.js
47 lines (41 loc) · 1.78 KB
/
rollup.npm.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
export default [
...makeNPMConfigVariants(
makeBaseNPMConfig({
// We need to include `instrumentServer.ts` separately because it's only conditionally required, and so rollup
// doesn't automatically include it when calculating the module dependency tree.
entrypoints: ['src/index.server.ts', 'src/index.client.ts', 'src/utils/instrumentServer.ts'],
// prevent this internal nextjs code from ending up in our built package (this doesn't happen automatially because
// the name doesn't match an SDK dependency)
packageSpecificConfig: { external: ['next/router'] },
}),
),
...makeNPMConfigVariants(
makeBaseNPMConfig({
entrypoints: ['src/config/templates/prefixLoaderTemplate.ts'],
packageSpecificConfig: {
output: {
// preserve the original file structure (i.e., so that everything is still relative to `src`)
entryFileNames: 'config/templates/[name].js',
// this is going to be add-on code, so it doesn't need the trappings of a full module (and in fact actively
// shouldn't have them, lest they muck with the module to which we're adding it)
sourcemap: false,
esModule: false,
},
},
}),
),
...makeNPMConfigVariants(
makeBaseNPMConfig({
entrypoints: ['src/config/loaders/prefixLoader.ts'],
packageSpecificConfig: {
output: {
// make it so Rollup calms down about the fact that we're doing `export { loader as default }`
exports: 'default',
// preserve the original file structure (i.e., so that everything is still relative to `src`)
entryFileNames: 'config/loaders/[name].js',
},
},
}),
),
];