mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[Build] revert site to webpack config (#3747)
This commit is contained in:
87
build/webpack.dev.js
Normal file
87
build/webpack.dev.js
Normal file
@@ -0,0 +1,87 @@
|
||||
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/desktop/main.js',
|
||||
'vant-mobile': './docs/site/mobile/main.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', '.less']
|
||||
},
|
||||
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']
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new ProgressBarPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['vant-docs'],
|
||||
template: 'docs/site/desktop/index.html',
|
||||
filename: 'index.html',
|
||||
inject: true
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
chunks: ['vant-mobile'],
|
||||
template: 'docs/site/mobile/index.html',
|
||||
filename: 'mobile.html',
|
||||
inject: true
|
||||
})
|
||||
]
|
||||
};
|
Reference in New Issue
Block a user