-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
42 lines (40 loc) · 1.33 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
const path = require('path');
const babel = require('rollup-plugin-babel');
const json = require('rollup-plugin-json');
const sass = require('rollup-plugin-sass');
const entryFile = require(path.resolve('package.json')).entry || path.resolve('index.js');
const outputPath = path.resolve('lib');
module.exports = {
plugins: [
json({ include: path.resolve('package.json') }),
babel({
exclude: [`${path.resolve('node_modules')}/**`, '**/*.scss', '**/*.json'],
babelrc: false,
presets: [
[
'env',
{
targets: {
browsers: ['last 2 versions', 'safari >= 7'],
},
modules: false,
},
],
'react',
],
plugins: ['external-helpers', 'transform-object-rest-spread'],
}),
sass({
output: `${path.resolve('lib')}/styles.css`,
options: {
outputStyle: 'compressed',
includePaths: [path.resolve('node_modules')],
},
}),
],
entry: entryFile,
targets: [
{ dest: `${outputPath}/bundle.cjs.js`, format: 'cjs' },
{ dest: `${outputPath}/bundle.es.js`, format: 'es' },
],
};