Skip to content

Instantly share code, notes, and snippets.

@ronal2do
Created July 27, 2016 12:40
Show Gist options
  • Save ronal2do/e6ebcad3f7eec738da6800045686b6e1 to your computer and use it in GitHub Desktop.
Save ronal2do/e6ebcad3f7eec738da6800045686b6e1 to your computer and use it in GitHub Desktop.
var webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: './dist',
publicPath: 'dist/',
filename: 'build.js'
},
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
// edit this for additional asset file types
test: /\.(png|jpg|gif)$/,
loader: 'file?name=[name].[ext]?[hash]'
}
]
},
// example: if you wish to apply custom babel options
// instead of using vue-loader's default:
babel: {
presets: ['es2015', 'stage-0'],
plugins: ['transform-runtime']
}
}
if (process.env.NODE_ENV === 'production') {
module.exports.plugins = [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
} else {
module.exports.devtool = '#source-map'
}
// package
//...
"scripts": {
"dev": "webpack-dev-server --inline --hot --quiet",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^1.0.18"
},
"devDependencies": {
"babel-core": "^6.1.2",
"babel-loader": "^6.1.0",
"babel-plugin-transform-runtime": "^6.1.2",
"babel-preset-es2015": "^6.1.2",
"babel-preset-stage-0": "^6.1.2",
"babel-runtime": "^5.8.0",
"cross-env": "^1.0.5",
"css-loader": "^0.23.0",
"file-loader": "^0.8.4",
"jade": "^1.11.0",
"style-loader": "^0.13.0",
"stylus-loader": "^1.4.0",
"template-html-loader": "0.0.3",
"vue-hot-reload-api": "^1.2.0",
"vue-html-loader": "^1.0.0",
"vue-loader": "^7.2.0",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
},
//.....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment