This repository has been archived by the owner on May 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
61 lines (57 loc) · 2.04 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
54
55
56
57
58
59
60
61
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace'
import postcss from 'rollup-plugin-postcss'
import alias from '@rollup/plugin-alias'
import babel from 'rollup-plugin-babel'
import json from '@rollup/plugin-json'
import image from '@rollup/plugin-image';
import dotenv from 'dotenv'
dotenv.config({ path: `./.env.${process.env.APP_ENV}` })
const packageJson = require('./package.json')
const customResolver = resolve({
extensions: ['.mjs', '.js', '.jsx', '.json', '.sass', '.scss', '/index.js']
})
export default [
{
input: 'src/index.js',
output: [
{
file: packageJson.module,
format: 'esm',
sourcemap: true
}
],
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.APP_ENV': JSON.stringify(process.env.APP_ENV),
'process.env.APP_TEST_USER': JSON.stringify(process.env.APP_TEST_USER),
'process.env.ASF_IFRAME_SRC': JSON.stringify(process.env.ASF_IFRAME_SRC),
preventAssignment: true
}),
alias({
entries: {
'@axios': `${__dirname}/src/axios`,
'@components': `${__dirname}/src/components`,
'@global': `${__dirname}/src/global`,
'@parts': `${__dirname}/src/parts`,
'@redux': `${__dirname}/src/redux`,
'@utils': `${__dirname}/src/utils`
},
customResolver
}),
peerDepsExternal(),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
}),
image(),
json(),
postcss(),
resolve({ preferBuiltins: true, mainFields: ['browser'] }),
commonjs()
]
}
]