-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
53 lines (51 loc) · 1.35 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
46
47
48
49
50
51
52
53
import typescript from 'rollup-plugin-typescript2';
import del from 'rollup-plugin-delete';
import alias from '@rollup/plugin-alias'; // 配置别名
// import { getBabelOutputPlugin } from '@rollup/plugin-babel';
import copy from 'rollup-plugin-copy';
import resolve from "@rollup/plugin-node-resolve"; // 解析 node 包
import commonjs from "@rollup/plugin-commonjs"; // 适配 commonjs 导入的包
import replace from '@rollup/plugin-replace';
import path from 'path';
import postcss from 'rollup-plugin-postcss';
export default {
input: [
'src/scripts/vendor.ts',
'src/background/background.ts',
'src/popup/popup.tsx',
'src/options/options.tsx',
],
output: {
dir: 'dist/js/',
format: 'esm',
},
plugins: [
del({ targets: 'dist/*' }),
alias({
entries: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
]
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
'preventAssignment': true
}),
resolve(),
commonjs(),
copy({
targets: [
{ src: 'public/*', dest: 'dist/' },
]
}),
typescript({ tsconfig: 'tsconfig.json' }),
postcss({
plugins: [
require('tailwindcss'),
require('autoprefixer'),
]
}),
// getBabelOutputPlugin({
// configFile: path.resolve(__dirname, '.babelrc')
// })
],
}