storybook/lib/cli/test/fixtures/vue/rollup.config.js
2017-08-30 02:47:15 +03:00

56 lines
1.2 KiB
JavaScript

import alias from 'rollup-plugin-alias'
import vue from 'rollup-plugin-vue'
import buble from 'rollup-plugin-buble'
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import nodeGlobals from 'rollup-plugin-node-globals'
import butternut from 'rollup-plugin-butternut'
import livereload from 'rollup-plugin-livereload'
import serve from 'rollup-plugin-serve'
const plugins = [
alias({
vue$: 'vue/dist/vue.common.js'
}),
vue({
css: './public/assets/css/app.css'
}),
buble({
objectAssign: 'Object.assign'
}),
nodeResolve({
jsnext: true,
main: true,
browser: true
}),
commonjs(),
nodeGlobals()
]
const config = {
entry: './src/main.js',
dest: './public/assets/js/app.js',
format: 'es',
sourceMap: true,
plugins: plugins
}
const isProduction = process.env.NODE_ENV === `production`
const isDevelopment = process.env.NODE_ENV === `development`
if (isProduction) {
config.sourceMap = false
config.plugins.push(butternut())
}
if (isDevelopment) {
config.plugins.push(livereload())
config.plugins.push(serve({
contentBase: './public/',
port: 8080,
open: true
}))
}
export default config