Created
December 13, 2016 17:23
-
-
Save congrady/1797c706c0229d65826842028756bb45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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