-
-
Notifications
You must be signed in to change notification settings - Fork 582
/
build.config.ts
43 lines (41 loc) · 1.11 KB
/
build.config.ts
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
import { defineBuildConfig } from 'unbuild';
import banner from 'rollup-plugin-banner2';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import replace from '@rollup/plugin-replace';
const version = JSON.parse(
readFileSync(join(__dirname, 'package.json'), 'utf-8'),
).version;
export default defineBuildConfig({
entries: [
'./packages/million',
'./packages/experimental',
'./packages/jsx-runtime',
'./packages/compiler',
'./packages/react',
'./packages/react-server',
'./packages/types',
'./packages/cli',
],
declaration: true,
clean: true,
failOnWarn: false,
rollup: {
emitCJS: true,
inlineDependencies: true,
},
hooks: {
'rollup:options'(_ctx, options) {
if (Array.isArray(options?.plugins)) {
options.plugins.push(banner(() => `'use client';\n`) as any);
options.plugins.push(
replace({
preventAssignment: true,
'process.env.VERSION': JSON.stringify(version),
}),
);
}
},
},
externals: ['react', 'react-dom', 'million', 'vite', 'esbuild', 'rollup'],
});