Skip to content

Commit

Permalink
Fix build for vui
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed May 11, 2016
1 parent bb968fa commit 688aaae
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"postcss-css-variables": "^0.5.1",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.9.1",
"style-loader": "^0.13.0",
"vue": "^1.0.16",
"vue-hot-reload-api": "^1.3.2",
"vue-html-loader": "^1.1.0",
Expand Down
31 changes: 18 additions & 13 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')

var cssLoader = 'vue-style!css?sourceMap!postcss'
if (process.env.NODE_ENV === 'production') {
cssLoader = ExtractTextPlugin.extract('vue-style', 'css!postcss')
}

var contentBase = __dirname + '/public'
var pkg = require('./package.json')

var plugins = [new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'development')
}
})]


var options = {
entry: {
app: [
Expand Down Expand Up @@ -46,23 +56,18 @@ var options = {
publicPath: '/assets/',
},

plugins: plugins,

devtool: 'source-map',
}

if (process.env.NODE_ENV === 'production') {
var defplugin = new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
})
var minplugin = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
options.plugins.push(defplugin)
options.plugins.push(minplugin)
options.plugins.push(new webpack.optimize.OccurenceOrderPlugin())
options.entry.vendor = Object.keys(pkg.dependencies)
plugins.push(new ExtractTextPlugin('app.css', {disable: false}))
plugins.push(new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js"))
plugins.push(new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}))
plugins.push(new webpack.optimize.OccurenceOrderPlugin())
options.plugins = plugins
}

module.exports = options

0 comments on commit 688aaae

Please sign in to comment.