Refactored, added es5 build

This commit is contained in:
euvl
2017-04-05 11:34:38 +01:00
parent 5109f89848
commit 3d9c97722f
15 changed files with 10570 additions and 117 deletions

View File

@@ -1,17 +1,13 @@
var path = require('path')
var webpack = require('webpack')
module.exports = {
entry: './examples/src/main.js',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
filename: 'index.js'
},
externals: [
],
module: {
rules: [
{
@@ -19,9 +15,13 @@ module.exports = {
loader: 'vue-loader',
options: {
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
'scss': 'vue-style-loader!css-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
},
{
@@ -40,12 +40,12 @@ module.exports = {
},
resolve: {
alias: {
'vue': 'vue/dist/vue.js',
'nice-vue-components$': path.resolve(__dirname, './components/index.js')
'vue$': 'vue/dist/vue.esm.js'
}
},
devServer: {
historyApiFallback: true
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
@@ -54,20 +54,28 @@ module.exports = {
}
if (process.env.NODE_ENV === 'production') {
module.exports.entry = './src/index.js'
module.exports.output = {
path:'./dist',
filename:'index.js',
library:'VueJsToggleButton',
libraryTarget: 'umd'
}
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
/*new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
}),*/
new webpack.LoaderOptionsPlugin({
minimize: true
})