-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
45 lines (44 loc) · 1.45 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
// import dynamicImportVars from '@rollup/plugin-dynamic-import-vars'
import replace from '@rollup/plugin-replace'
import babel from '@rollup/plugin-babel'
import typescript from '@rollup/plugin-typescript'
// import terser from '@rollup/plugin-terser'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import { defineConfig } from 'rollup'
import del from 'rollup-plugin-delete'
import process from 'node:process'
export default [
defineConfig({
input: ['./src/background.ts', './src/content.tsx', './src/popup.tsx', './src/options.tsx'],
output: {
dir: 'dist',
format: 'esm',
chunkFileNames: 'chunks/[name]-[hash].js',
sourcemap: true,
},
onwarn(warning, warn) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return
}
warn(warning)
},
plugins: [
del({ targets: 'dist', runOnce: true }),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
preventAssignment: true,
}),
typescript(),
babel({
babelHelpers: 'bundled',
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),
nodeResolve(),
commonjs(),
// dynamicImportVars(), // 이 플러그인은 동적 import를 다루는 것이므로 필요에 따라 배치
// terser(),
],
}),
]