-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.config.mjs
51 lines (44 loc) · 1.38 KB
/
rollup.config.mjs
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
48
49
50
51
import resolve from '@rollup/plugin-node-resolve';
import esbuild from 'rollup-plugin-esbuild'
import sourcemaps from 'rollup-plugin-sourcemaps';
import typescript from '@rollup/plugin-typescript';
import filesize from 'rollup-plugin-filesize';
import { glob } from 'glob'
import config from './tsconfig.json' with { type: "json" };
const isProduction = !process.env.IS_DEVELOPMENT;
const sourcemap = !isProduction;
const clearScreen = { watch: { clearScreen: false } };
console.log({ isProduction, sourcemap });
const external = ['react', 'react-dom', 'next/navigation', 'react-router', 'react-router-dom', '@remix-run']
const plugins = [
resolve({
include: ['node_modules/**'],
}),
typescript({
tsconfig: './tsconfig.build.json',
compilerOptions: { ...config.compilerOptions, sourceMap: sourcemap, declarationMap: sourcemap, declaration: true },
}),
!isProduction && sourcemaps(),
esbuild({
sourceMap: !isProduction, // default
minify: isProduction,
target: 'es2023', // default, or 'es20XX', 'esnext'
}),
filesize(),
].filter(Boolean);
export default [
{
input: glob.sync("packages/urlstate/**/index.ts"),
plugins,
external,
output: [{
dir: 'dist',
format: 'es',
sourcemap,
preserveModules: true,
preserveModulesRoot: './packages/urlstate',
entryFileNames: '[name].mjs'
}],
...clearScreen,
},
];