• mac 安装及配置vue


    1. mac 安装brew (建议使用VPN,网速更快)
      /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

    2.使用brew安装npm
    brew install node

    确认node及npm版本
    在这里插入图片描述
    3. 查询并配置npm 源
    npm config get registry
    ###临时源
    npm --registry https://registry.npm.taobao.org install cluster

    4.安装 vue
    npm install vue -g
    npm install webpack -g
    npm install vue-cli -g

    1. 确认vue版本
      npm info vue
      在这里插入图片描述
    2. 使用vscode 创建vue项目(yy项目)
      vue create yy

    7.配置 vue.config.js
    ###################
    const { defineConfig } = require(‘@vue/cli-service’)
    module.exports = defineConfig({
    transpileDependencies: true,
    publicPath: “./”,// 公共路径 默认为"/“,建议使用”./"相对路径
    devServer: { // 本地服务器配置(npm run serve)
    port: 8080, // 端口
    host: “127.0.0.1”, // 域名
    https: false, // 是否开启https
    open: true // 是否在开启服务器后自动打开浏览器访问该服务器
    },
    lintOnSave: false, // 取消lint语法检测,此处可不配置
    outputDir:“dist”, // build打包输出目录
    assetsDir:“assets”, // 静态文件输出目录,基于dist
    indexPath: “index.html”, // 输出html文件名
    productionSourceMap: false, // 取消.map文件的打包,加快打包速度
    configureWebpack: (config) => {
    // process.env为环境变量,分别对应.env.development文件和.env.production文件 此处表示加快开发环境打包速度
    if (process.env.NODE_ENV !== ‘production’) return;
    config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true; //生产环境去掉console.log
    return { // 此处配置webpack.config.js的相关配置
    plugins: [],
    performance: {}
    };}})
    ##################
    在这里插入图片描述
    8.启动 yy项目
    cd yy
    npm run serve

    在这里插入图片描述

  • 相关阅读:
    使用Python进行时间序列分析的8种图
    MATLAB算法实战应用案例精讲-【图像处理】机器视觉(应用篇)
    Ubuntu 24.04 LTS 安装Docker
    MockJs
    vue3中引入全局的less 和配置代理
    pytest:如何在测试中编写和报告断言
    Vue3 setup中使用生命周期函数
    PostgreSQL中的技术内幕
    Socket网络编程及其实现(图文)
    HTML静态网页成品作业(HTML+CSS)——家乡泉州介绍网页(3个页面)(表格布局)
  • 原文地址:https://blog.csdn.net/qq_37137713/article/details/126802826