Created
December 1, 2016 09:16
-
-
Save faforty/68ef18e3cf1f2232fe2fcabd99a20ba6 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
var webpack = require('webpack'), | |
path = require('path'), | |
progressBarPlugin = require('progress-bar-webpack-plugin'), | |
ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const FgYellow = '\x1b[33m' | |
console.log(FgYellow, 'Run build uiKit...') | |
var extractCSS = new ExtractTextPlugin('/css/uiKit.css'); | |
module.exports = { | |
entry: [ | |
'./src/vue/index.js', | |
'./src/scss/main.scss' | |
], | |
output: { | |
path: path.resolve(__dirname, './dist'), | |
publicPath: '/', | |
filename: '/js/uiKit.2.0.1.js' | |
}, | |
resolve: { | |
extensions: ['', '.js', '.vue'], | |
fallback: [path.join(__dirname, '../node_modules')], | |
}, | |
resolveLoader: { | |
root: path.join(__dirname, 'node_modules'), | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.vue$/, | |
loader: 'vue' | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'babel', | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf)$/, | |
loader: 'file', | |
query: { | |
name: 'fonts/[name].[ext]?[hash]' | |
} | |
}, | |
{ | |
test: /\.(png|svg)$/, | |
loader: 'file', | |
query: { | |
name: 'images/[name].[ext]?[hash]' | |
} | |
}, | |
{ test: /\.scss$/i, loader: extractCSS.extract(['css!sass?indentedSyntax=true&sourceMap=true']) } | |
] | |
}, | |
devtool: '#eval-source-map', | |
plugins: [ | |
new webpack.DefinePlugin({ | |
'process.env': { | |
NODE_ENV: '"production"' | |
} | |
}), | |
extractCSS, | |
new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
warnings: false | |
} | |
}), | |
// new webpack.optimize.DedupePlugin(), | |
new progressBarPlugin() | |
] | |
} | |
if (process.env.NODE_ENV === 'production') { | |
module.exports.devtool = '#source-map' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment