• 欢迎光临~

项目打包

开发技术 开发技术 2022-10-14 次浏览
  1. vue.2.0 (webpack)打包配置
    vue.config.js
     module.exports = {
        publicPath: './',
      }
    rout文件
    onst router = new VueRouter({
      mode: 'history', 把history改为hash
      base: process.env.BASE_URL,
      routes
    })

    export default router

      

  2. vue3.0 (webpack)打包配置
    vue.config.js
     module.exports = {
        publicPath: './',
      }
    rout文件
    
    const router = createRouter({
      history:createWebHashHistory(process.env.BASE_URL), 修改为createWebHistory(process.env.BASE_URL), 
      routes
    })
    

      

  3. react(vite)打包配置
  4. react(webpack)打包配置
    package.json
    增加
    {
    "homepage": "./",
    }
    写成HashRouter模式
    import { HashRouter as Router, Route, Switch, Link } from "react-router-dom";

     

程序员灯塔
转载请注明原文链接:项目打包
喜欢 (0)
违法和不良信息举报电话:022-22558618 举报邮箱:dljd@tidljd.com