42 lines
1 KiB
JavaScript
42 lines
1 KiB
JavaScript
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'
|
|
|
|
export default {
|
|
input: 'src/index.js',
|
|
output: [
|
|
{
|
|
file: main,
|
|
format: 'cjs',
|
|
sourcemap: true
|
|
},
|
|
{
|
|
file: module,
|
|
format: 'es',
|
|
sourcemap: true
|
|
}
|
|
],
|
|
plugins: [
|
|
peerDepsExternal(),
|
|
resolve(),
|
|
json(),
|
|
babel({
|
|
exclude: 'node_modules/**'
|
|
}),
|
|
sass({
|
|
output(styles, styleNodes) {
|
|
fs.writeFileSync('./src/bundle.css.js', 'export default `' + styles + '`;')
|
|
}
|
|
}),
|
|
minify({
|
|
comments: false,
|
|
sourceMap: true,
|
|
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
|
})
|
|
]
|
|
}
|