Skip to content

Instantly share code, notes, and snippets.

@congrady
Created December 13, 2016 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save congrady/1797c706c0229d65826842028756bb45 to your computer and use it in GitHub Desktop.
Save congrady/1797c706c0229d65826842028756bb45 to your computer and use it in GitHub Desktop.
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 uglify from 'rollup-plugin-uglify'
import { minify } from 'uglify-js'
import livereload from 'rollup-plugin-livereload'
import serve from 'rollup-plugin-serve'
const plugins = [
alias({
vue: 'node_modules/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/app.js',
dest: './public/assets/js/app.js',
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(uglify({}, minify))
}
if (isDevelopment) {
config.plugins.push(livereload())
config.plugins.push(serve({
contentBase: './public/',
port: 8080,
open: true
}))
}
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment