webpack5搭建vue3教-基础篇

webpack5搭建vue3教-基础篇

一.安装vue环境:

1.安装nodejs;

nodejs包含了npm

 

二.安装webpack四件套:

npm install webpack webpack-cli webpack-server webpack-merge -D

 

三.初始化项目:

npm init -y

 

四.配置简单webpack:

1.在根目录下创建webpack.config.js文件

// webpack.config.js
const path = require('path');

module.exports = {
    mode: 'development',
    entry: './src/index.js',
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist')
    }
}

 

2.配置package.json

  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack"
  },

 

posted @ 2021-06-10 12:19  土豆哥  阅读(964)  评论(0编辑  收藏  举报