-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
34 lines (31 loc) · 992 Bytes
/
rollup.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
import commonjs from '@rollup/plugin-commonjs';
import node from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import json from '@rollup/plugin-json';
import typescript from '@rollup/plugin-typescript';
import { generateRollupOptions } from '@vuedx/monorepo-tools';
import * as Path from 'path';
const BUILD = process.env.BUILD ?? 'production';
const isProd = BUILD === 'production';
const values = {
__DEV__: JSON.stringify(!isProd),
__PROD__: JSON.stringify(isProd),
__PREVIEW_INSTALLATION_SOURCE__: JSON.stringify(Path.resolve(__dirname, './packages/preview/')),
};
export default generateRollupOptions({
extend(kind, info) {
if (kind === 'dts') return info.rollupOptions;
return {
...info.rollupOptions,
plugins: [
node(),
commonjs(),
json(),
replace({ values, preventAssignment: true }),
typescript({
tsconfig: info.tsconfig?.configFile,
}),
],
};
},
});