forked from riccardoperra/codeimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.ts
More file actions
37 lines (33 loc) · 1014 Bytes
/
rollup.config.ts
File metadata and controls
37 lines (33 loc) · 1014 Bytes
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
import {defineConfig, ModuleFormat, OutputOptions, RollupOptions} from 'rollup';
import {dependencies, peerDependencies} from './package.json';
import withSolid from './tools/with-solid';
const externals = [
...Object.keys(peerDependencies),
...Object.keys(dependencies),
'solid-js/web',
'solid-js/store',
'@vanilla-extract/recipes/createRuntimeFn',
];
function buildOutput(format: ModuleFormat): OutputOptions {
return {
preserveModules: true,
preserveModulesRoot: 'src',
assetFileNames({name}) {
return name!.replace(/^src\//, '');
},
exports: 'named',
dir: `./dist/${format}`,
format: format,
};
}
const solidConfig = withSolid({
input: {
index: 'src/index.tsx',
'lightTheme.css': './src/lib/themes/light-theme.css.ts',
'darkTheme.css': './src/lib/themes/dark-theme.css.ts',
},
targets: ['esm', 'cjs'],
external: externals,
output: [buildOutput('esm'), buildOutput('cjs')],
});
export default defineConfig(solidConfig as RollupOptions);