公共组件、公共样式集合
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.6 KiB

1 week ago
// build/webpack.dev.js
const path = require('path')
const { merge } = require('webpack-merge')
const baseConfig = require('./webpack.config.js')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = merge(baseConfig, {
mode: 'development',
entry: path.resolve(__dirname, '../examples/src/main.js'),
output: {
path: path.resolve(__dirname, '../examples/dist'),
filename: 'bundle.js',
publicPath: '/'
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js' // 明确指定完整版Vue
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
compilerOptions: {
preserveWhitespace: false
}
}
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
type: 'asset/resource',
generator: {
filename: 'fonts/[name].[hash:8][ext]'
}
},
{test: /\.vue$/, use: 'vue-loader'}
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../examples/public/index.html'),
filename: 'index.html'
}),
new VueLoaderPlugin()
],
devServer: {
static: {
directory: path.join(__dirname, '../examples/dist')
},
compress: true,
port: 9000,
hot: true,
open: true
}
})