webpack配置vue3项目
npm init
npm i css-loader style-loader vue-loader webpack webpack-cli -D
npm i vue@latest
新建webpack.config.js
/**
* @Author: ZHIWEI
* @Description: webpack.config
* @Date: 2022/3/9 15:48
*/
let path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
mode: 'production',
entry: './dyMethods.js',
output: {
filename: 'dyMethods.js',
path: path.resolve(__dirname, 'build')
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
reactivityTransform: true
}
}
]
},
plugins: [
new VueLoaderPlugin()
]
}
【webpack配置vue3项目】新建app.js
import { createApp } from 'vue'
import App from './App.vue' createApp(App).mount(#app)
package.json
{
"name": "side-bar-vue",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --config webpack.config.js"
},
"author": "zhiwei",
"license": "ISC",
"devDependencies": {
"css-loader": "^6.7.1",
"style-loader": "^3.3.1",
"vue-loader": "^17.0.0",
"webpack": "^5.70.0",
"webpack-cli": "^4.9.2"
},
"dependencies": {
"vue": "^3.2.31"
}
}
推荐阅读
- umi3.0|umi3.0 配置全局路由及菜单
- Spring Boot 保护敏感配置的 4 种方法,让你的系统不再裸奔!!
- Vue3中setup语法糖学习
- 详解在vue3中使用jsx的配置以及一些小问题
- C/C++|C/C++ 大型工程工具链搭建
- VUE3|VUE3 之 多个组件之间的过渡 - 这个系列的教程通俗易懂,适合新手
- Vue3响应式原理
- Python使用chrome配置selenium操作详解
- ASP.NET|ASP.NET CORE读取json格式配置文件
- 前端|记录一次Vue3.0引入ElementPlus之后样式不生效的一个大坑