first commit
This commit is contained in:
1
dbui/build/.pydio
Normal file
1
dbui/build/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
27cdb2bf-a1ee-4d5e-9e7a-7d1b598078da
|
||||
108
dbui/build/webpack.base.config.js
Normal file
108
dbui/build/webpack.base.config.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* 公共配置
|
||||
*/
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const pkg = require('../package.json');
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
// 加载器
|
||||
module: {
|
||||
// https://doc.webpack-china.org/guides/migrating/#module-loaders-module-rules
|
||||
rules: [
|
||||
{
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
css: [
|
||||
'vue-style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
less: [
|
||||
'vue-style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
postLoaders: {
|
||||
html: 'babel-loader?sourceMap'
|
||||
},
|
||||
sourceMap: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: 'ts-loader',
|
||||
options: { appendTsSuffixTo: [/\.vue$/]},
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'vue-style-loader',
|
||||
'css-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
use: [
|
||||
'vue-style-loader',
|
||||
'css-loader',
|
||||
'less-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
|
||||
loader: 'url-loader?limit=8192'
|
||||
},
|
||||
{
|
||||
test: /\.(html|tpl)$/,
|
||||
loader: 'html-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.ts'],
|
||||
alias: {
|
||||
'vue': 'vue/dist/vue.esm.js',
|
||||
'@': resolve('src')
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.VERSION': `'${pkg.version}'`
|
||||
}),
|
||||
]
|
||||
};
|
||||
48
dbui/build/webpack.dev.config.js
Normal file
48
dbui/build/webpack.dev.config.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 本地预览
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
// const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const merge = require('webpack-merge');
|
||||
const webpackBaseConfig = require('./webpack.base.config.js');
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
||||
|
||||
|
||||
module.exports = merge(webpackBaseConfig, {
|
||||
devtool: 'eval-source-map',
|
||||
|
||||
// 入口
|
||||
entry: {
|
||||
main: './examples/main.ts',
|
||||
vendors: ['vue', 'vue-router']
|
||||
},
|
||||
// 输出
|
||||
output: {
|
||||
path: path.join(__dirname, '../examples/dist'),
|
||||
publicPath: '',
|
||||
filename: '[name].js',
|
||||
chunkFilename: '[name].chunk.js'
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
vue: 'vue/dist/vue.esm.js'
|
||||
}
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
name:'vendor'
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
inject: true,
|
||||
filename: path.join(__dirname, '../examples/dist/index.html'),
|
||||
template: path.join(__dirname, '../examples/index.html')
|
||||
}),
|
||||
new FriendlyErrorsPlugin()
|
||||
]
|
||||
});
|
||||
48
dbui/build/webpack.dist.prod.config.js
Normal file
48
dbui/build/webpack.dist.prod.config.js
Normal file
@@ -0,0 +1,48 @@
|
||||
const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const merge = require('webpack-merge');
|
||||
const webpackBaseConfig = require('./webpack.base.config.js');
|
||||
const CompressionPlugin = require('compression-webpack-plugin');
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
module.exports = merge(webpackBaseConfig, {
|
||||
devtool: 'source-map',
|
||||
entry: {
|
||||
main: './src/index.js'
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../dist'),
|
||||
publicPath: '/dist/',
|
||||
filename: 'dbui.min.js',
|
||||
library: 'dbui',
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true
|
||||
},
|
||||
externals: {
|
||||
vue: {
|
||||
root: 'Vue',
|
||||
commonjs: 'vue',
|
||||
commonjs2: 'vue',
|
||||
amd: 'vue'
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
// @todo
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': '"production"'
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
parallel: true,
|
||||
sourceMap: true
|
||||
}),
|
||||
new CompressionPlugin({
|
||||
filename: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: /\.(js|css)$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user