123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const path=require('path');
- const { CleanWebpackPlugin } = require('clean-webpack-plugin');
- //const { HtmlWebpackPlugin } = require("html-webpack-plugin");
- const HtmlWebpackPlugin = require('html-webpack-plugin');
- //const { VueLoaderPlugin } = require('vue-loader/dist/index');
- const { VueLoaderPlugin } = require('vue-loader');
- module.exports={
- entry:{
- index:"./index.js",
- },
- output:{
- filename:"bundle.js",
- path:path.resolve(__dirname,"./dist")
- },
- resolve: {
- alias: {
- vue: 'vue/dist/vue.esm-bundler.js' // 关键配置
- }
- },
- module:{
- rules:[
- {
- test:/\.css$/i,
- use:["style-loader","css-loader"]
- },
- {
- test:/\.vue$/,
- use:[
- { loader:"vue-loader" }
- ]
- },
- // 处理 .js 文件
- {
- test: /\.js$/,
- loader: 'babel-loader',
- exclude: /node_modules/
- }]
- },
- plugins:[
- new VueLoaderPlugin(),
- new CleanWebpackPlugin(),
- new HtmlWebpackPlugin({
- inject:'head',
- title:"index page ",
- template:"./index.html",
- filename:"index.html",
- chunks:['index'],
- }),
- ]
- }
|