forked from ishu3101/copy-url-and-title
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
47 lines (43 loc) · 1.27 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
import path from 'path'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace'
import resolve from '@rollup/plugin-node-resolve'
import { chromeExtension, simpleReloader } from 'rollup-plugin-chrome-extension'
import { emptyDir } from 'rollup-plugin-empty-dir'
import zip from 'rollup-plugin-zip'
import postcss from 'rollup-plugin-postcss'
const isProduction = process.env.NODE_ENV === 'production'
export default {
input: 'src/manifest.json',
output: {
dir: 'dist',
format: 'esm',
chunkFileNames: path.join('chunks','[name]-[hash].js'),
},
plugins: [
postcss({
extract: true,
minimize: isProduction,
}),
chromeExtension(),
// Adds a Chrome extension reloader during watch mode
simpleReloader(),
// Replace environment variables
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
babel({
// Do not transpile dependencies
ignore: ['node_modules'],
babelHelpers: 'bundled',
}),
resolve(),
commonjs(),
// Empties the output dir before a new build
emptyDir(),
// Outputs a zip file in ./releases
isProduction && zip({ dir: 'releases' }),
],
}