-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
44 lines (43 loc) · 995 Bytes
/
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 sass from '@csstools/postcss-sass';
import css from '@modular-css/rollup';
import sassSyntax from 'postcss-scss';
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
export default {
input: 'src/index.js',
output: [
{
file: 'lib/index.js',
assetFileNames: '[name][extname]',
format: 'cjs',
},
{
file: 'es/index.js',
assetFileNames: '[name][extname]',
format: 'esm',
},
],
external: ['react', 'prop-types', 'classnames'],
plugins: [
resolve(),
babel(),
css({
include: /\.scss$/i,
before: [sass()],
map: false,
postcss: {
syntax: sassSyntax,
},
}),
{
name: 'add-css',
renderChunk(code, _, { format }) {
return (
(format === 'cjs'
? '"use strict";\nrequire("./index.css");\n'
: 'import "./index.css";\n') + code.replace(/^'use strict';/, '')
);
},
},
],
};