2019-12-15 14:12:29 +01:00
|
|
|
import babel from 'rollup-plugin-babel'
|
|
|
|
import resolve from 'rollup-plugin-node-resolve'
|
|
|
|
import json from 'rollup-plugin-json'
|
|
|
|
import sass from 'rollup-plugin-sass'
|
|
|
|
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
|
|
|
|
import minify from 'rollup-plugin-babel-minify'
|
|
|
|
import { version, name, description, author, license, main, module } from './package.json'
|
|
|
|
import fs from 'fs'
|
2018-08-05 11:56:55 +02:00
|
|
|
|
|
|
|
export default {
|
2019-12-15 14:12:29 +01:00
|
|
|
input: 'src/index.js',
|
2019-05-31 18:20:29 +02:00
|
|
|
output: [
|
|
|
|
{
|
|
|
|
file: main,
|
2019-12-15 14:12:29 +01:00
|
|
|
format: 'cjs',
|
2019-05-31 18:20:29 +02:00
|
|
|
sourcemap: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
file: module,
|
2019-12-15 14:12:29 +01:00
|
|
|
format: 'es',
|
2019-05-31 18:20:29 +02:00
|
|
|
sourcemap: true
|
|
|
|
}
|
|
|
|
],
|
2018-08-05 11:56:55 +02:00
|
|
|
plugins: [
|
2019-04-20 19:23:22 +02:00
|
|
|
peerDepsExternal(),
|
|
|
|
resolve(),
|
2018-08-05 11:56:55 +02:00
|
|
|
json(),
|
|
|
|
babel({
|
2019-12-15 14:12:29 +01:00
|
|
|
exclude: 'node_modules/**'
|
2018-09-26 12:17:10 +00:00
|
|
|
}),
|
2019-01-05 16:50:23 +01:00
|
|
|
sass({
|
|
|
|
output(styles, styleNodes) {
|
2019-12-15 14:12:29 +01:00
|
|
|
fs.writeFileSync('./src/bundle.css.js', 'export default `' + styles + '`;')
|
2019-01-05 16:50:23 +01:00
|
|
|
}
|
|
|
|
}),
|
2019-12-15 14:12:29 +01:00
|
|
|
minify({
|
|
|
|
comments: false,
|
|
|
|
sourceMap: true,
|
|
|
|
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
2018-08-05 11:56:55 +02:00
|
|
|
})
|
|
|
|
]
|
2019-12-15 14:12:29 +01:00
|
|
|
}
|