-
Notifications
You must be signed in to change notification settings - Fork 2
/
rollup.config.js
44 lines (39 loc) · 1.02 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
import babel from '@rollup/plugin-babel';
import {terser} from 'rollup-plugin-terser';
import nodeResolve from '@rollup/plugin-node-resolve';
import copy from 'rollup-plugin-copy';
import {argv} from 'yargs';
const compress = argv.compact;
const babelOptions = {
exclude: 'node_modules/**',
presets: [['@babel/preset-env', {modules: false}]],
babelrc: false,
};
const output = [
{
file: `dist/umd/i18nextShopify${compress ? '.min' : ''}.js`,
format: 'umd',
name: 'i18nextShopify',
},
{
file: `dist/amd/i18nextShopify${compress ? '.min' : ''}.js`,
format: 'amd',
name: 'i18nextShopify',
},
{
file: `dist/iife/i18nextShopify${compress ? '.min' : ''}.js`,
format: 'iife',
name: 'i18nextShopify',
},
];
const config = {
input: 'src/index.js',
plugins: [
babel(babelOptions),
nodeResolve({mainField: ['jsnext:main']}),
copy({targets: [{src: './index.d.ts', dest: 'dist/types'}]}),
].concat(compress ? terser() : []),
output,
external: ['react'],
};
export default config;