[Build] use vue-cli to build site (#3734)

This commit is contained in:
neverland
2019-07-03 12:58:39 +08:00
committed by GitHub
parent 53e9468c2c
commit 66459df72a
30 changed files with 7776 additions and 1304 deletions
+2 -2
View File
@@ -12,8 +12,8 @@ const tasks = [
'node build/build-components.js --color',
'node build/build-style.js',
'node build/build-style-entry.js',
'cross-env NODE_ENV=production webpack --color --config build/webpack.build.js',
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.build.js'
'cross-env NODE_ENV=production webpack --color --config build/webpack.config.js',
'cross-env NODE_ENV=production webpack -p --color --config build/webpack.config.js'
];
tasks.forEach(task => {
@@ -1,11 +1,8 @@
const path = require('path');
const config = require('./webpack.dev.js');
const isMinify = process.argv.indexOf('-p') !== -1;
delete config.serve;
module.exports = Object.assign(config, {
module.exports = {
mode: 'production',
entry: {
vant: './es/index.js'
@@ -26,8 +23,19 @@ module.exports = Object.assign(config, {
amd: 'vue'
}
},
performance: false,
optimization: {
minimize: isMinify
},
resolve: {
extensions: ['.js', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
}
});
};
-91
View File
@@ -1,91 +0,0 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
module.exports = {
mode: 'development',
entry: {
'vant-docs': './docs/site/index.js',
'vant-mobile': './docs/site/mobile.js'
},
output: {
path: path.join(__dirname, '../docs/dist'),
publicPath: '/',
chunkFilename: 'async_[name].js'
},
stats: {
modules: false,
children: false
},
devServer: {
open: true,
host: '0.0.0.0',
stats: 'errors-only',
clientLogLevel: 'warning'
},
resolve: {
extensions: ['.js', '.ts', '.tsx', '.vue', '.css']
},
module: {
rules: [
{
test: /\.vue$/,
use: [
{
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
}
]
},
{
test: /\.(js|ts|tsx)$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.less$/,
sideEffects: true,
use: [
'style-loader',
'css-loader',
'postcss-loader',
{
loader: 'less-loader',
options: {
paths: [path.resolve(__dirname, 'node_modules')]
}
}
]
},
{
test: /\.md$/,
use: ['vue-loader', '@vant/markdown-loader']
},
{
test: /\.(ttf|svg)$/,
loader: 'url-loader'
}
]
},
plugins: [
new VueLoaderPlugin(),
new ProgressBarPlugin(),
new HtmlWebpackPlugin({
chunks: ['vant-docs'],
template: 'docs/site/index.tpl',
filename: 'index.html',
inject: true
}),
new HtmlWebpackPlugin({
chunks: ['vant-mobile'],
template: 'docs/site/index.tpl',
filename: 'mobile.html',
inject: true
})
]
};
-14
View File
@@ -1,14 +0,0 @@
const path = require('path');
const config = require('./webpack.dev.js');
delete config.serve;
module.exports = Object.assign(config, {
mode: 'production',
output: {
path: path.join(__dirname, '../docs/dist'),
publicPath: 'https://youzan.github.io/vant/',
filename: '[name].[hash:8].js',
chunkFilename: 'async_[name].[chunkhash:8].js'
}
});