Skip to content

Commit

Permalink
separated build configs
Browse files Browse the repository at this point in the history
  • Loading branch information
shakee93 committed Sep 8, 2017
1 parent f8c0d1a commit 75b8003
Show file tree
Hide file tree
Showing 14 changed files with 7,695 additions and 14 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ npm-debug.log
yarn-error.log
.idea/
.vscode/
build/
src/
.babelrc
webpack.config.js
Expand Down
80 changes: 80 additions & 0 deletions build/webpack.release.core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var path = require('path')
var webpack = require('webpack')
var autoprefixer = require('autoprefixer')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
entry: {
'toasted' : './src/index-core.js',
'toasted.min' : './src/index-core.js'
},
output: {
path: './dist',
publicPath: '/dist/',
filename: '[name].js',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': 'vue-style-loader!css-loader!postcss-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!postcss-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
devtool: '#source-map'
}

if (process.env.NODE_ENV === 'production') {
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({
include: /\.min\.js$/,
sourceMap: false,
compress: { warnings: false },
comments: false,
}),
new webpack.ProvidePlugin({}),
// new BundleAnalyzerPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
54 changes: 54 additions & 0 deletions build/webpack.release.css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
var path = require('path')
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var autoprefixer = require('autoprefixer')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
entry: {
'vue-toasted.min' : './src/sass/toast.scss'
},
output: {
path: './dist',
publicPath: '/dist/',
filename: '[name].css',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
//resolve-url-loader may be chained before sass-loader if necessary
use: [{ loader: 'css-loader', options: { minimize: true }}, {
loader: 'postcss-loader',
options: {
config: {
path: './postcss.config.js'
}
}
}, 'sass-loader']
}),
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
performance: {
hints: false
}
}

if (process.env.NODE_ENV === 'production') {
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new ExtractTextPlugin('[name].css')
])
}
80 changes: 80 additions & 0 deletions build/webpack.release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
var path = require('path')
var webpack = require('webpack')
var autoprefixer = require('autoprefixer')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

module.exports = {
entry: {
'vue-toasted' : './src/index.js',
'vue-toasted.min' : './src/index.js'
},
output: {
path: './dist',
publicPath: '/dist/',
filename: '[name].js',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': 'vue-style-loader!css-loader!postcss-loader!sass-loader',
'sass': 'vue-style-loader!css-loader!postcss-loader!sass-loader?indentedSyntax'
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
}
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
devtool: '#source-map'
}

if (process.env.NODE_ENV === 'production') {
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({
include: /\.min\.js$/,
sourceMap: false,
compress: { warnings: false },
comments: false,
}),
new webpack.ProvidePlugin({}),
// new BundleAnalyzerPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
Loading

0 comments on commit 75b8003

Please sign in to comment.