webpack config
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
var webpack = require('webpack');
|
||||
var getPostcssPlugin = require('./utils/postcss_pipe');
|
||||
var config = require('./webpack.config.js');
|
||||
|
||||
config.entry = {
|
||||
@@ -14,6 +16,28 @@ config.externals = {
|
||||
vue: 'vue'
|
||||
};
|
||||
|
||||
config.plugins = [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': '"production"'
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
debug: false,
|
||||
options: {
|
||||
postcss: getPostcssPlugin,
|
||||
babel: {
|
||||
presets: ['es2015'],
|
||||
plugins: ['transform-runtime', 'transform-vue-jsx']
|
||||
},
|
||||
vue: {
|
||||
autoprefixer: false,
|
||||
preserveWhitespace: false,
|
||||
postcss: getPostcssPlugin
|
||||
}
|
||||
}
|
||||
})
|
||||
];
|
||||
|
||||
delete config.devtool;
|
||||
|
||||
module.exports = config;
|
||||
|
||||
Vendored
+9
-10
@@ -1,20 +1,19 @@
|
||||
var config = require('./webpack.build.js');
|
||||
var webpack = require('webpack');
|
||||
var getPostcssPlugin = require('./utils/postcss_pipe');
|
||||
var config = require('./webpack.config.js');
|
||||
|
||||
config.output.filename = config.output.filename.replace(/\.js$/, '.min.js');
|
||||
|
||||
config.plugins = [
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
debug: false
|
||||
}),
|
||||
config.plugins = config.plugins.concat([
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
comments: false,
|
||||
compress: {
|
||||
drop_console: true,
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
output: {
|
||||
comments: false
|
||||
},
|
||||
sourceMap: false
|
||||
})
|
||||
];
|
||||
]);
|
||||
|
||||
module.exports = config;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var path = require('path');
|
||||
var Components = require('../components.json');
|
||||
var config = require('./webpack.config.js');
|
||||
var config = require('./webpack.build.js');
|
||||
|
||||
delete config.devtool;
|
||||
|
||||
|
||||
+31
-5
@@ -8,6 +8,14 @@ var version = require('../package.json').version;
|
||||
var getPoastcssPlugin = require('./utils/postcss_pipe');
|
||||
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
var StyleExtractPlugin;
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
StyleExtractPlugin = new ExtractTextPlugin('[name].[hash:8].css');
|
||||
} else {
|
||||
StyleExtractPlugin = new ExtractTextPlugin('[name].css');
|
||||
}
|
||||
|
||||
function convert(str) {
|
||||
str = str.replace(/(&#x)(\w{4});/gi, function($0) {
|
||||
@@ -26,12 +34,12 @@ function wrap(render) {
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
'zanui-docs': './docs/index.js',
|
||||
'zanui-examples': './docs/examples.js'
|
||||
'docs': './docs/index.js',
|
||||
'examples': './docs/examples.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, '../docs/dist'),
|
||||
publicPath: '/vue/docs/dist/',
|
||||
publicPath: '/',
|
||||
filename: '[name].js'
|
||||
},
|
||||
resolve: {
|
||||
@@ -88,8 +96,20 @@ module.exports = {
|
||||
},
|
||||
devtool: 'source-map',
|
||||
plugins: [
|
||||
StyleExtractPlugin,
|
||||
new ProgressBarPlugin(),
|
||||
new ExtractTextPlugin('[name].css'),
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['docs'],
|
||||
template: 'docs/index.tpl',
|
||||
filename: 'index.html',
|
||||
inject: true
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['examples'],
|
||||
template: 'docs/index.tpl',
|
||||
filename: 'examples.html',
|
||||
inject: true
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
options: {
|
||||
@@ -145,6 +165,11 @@ module.exports = {
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
delete module.exports.devtool;
|
||||
module.exports.output = {
|
||||
path: path.join(__dirname, '../docs/dist'),
|
||||
publicPath: './',
|
||||
filename: '[name].[hash:8].js'
|
||||
};
|
||||
module.exports.plugins = module.exports.plugins.concat([
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
@@ -153,7 +178,8 @@ if (process.env.NODE_ENV === 'production') {
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
warnings: false,
|
||||
drop_console: true
|
||||
},
|
||||
output: {
|
||||
comments: false
|
||||
|
||||
Reference in New Issue
Block a user