1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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.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:'body',
- title:"webpack sample ",
- template:"./index.html"
- })
- ]
- }
|