V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
xiaohantx
V2EX  ›  问与答

想请教一下关于 vue 打包的问题

  •  1
     
  •   xiaohantx · 2020-12-28 16:56:37 +08:00 · 724 次点击
    这是一个创建于 1215 天前的主题,其中的信息可能已经有所发展或是发生改变。

    微信图片_20201228165334.png 想请问下如何外面 100 个 map 和 js 文件如何打包的时候不生成

    // All configuration item explanations can be find in https://cli.vuejs.org/config/
    module.exports = {
      /**
       * You will need to set publicPath if you plan to deploy your site under a sub path,
       * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
       * then publicPath should be set to "/bar/".
       * In most cases please use '/' !!!
       * Detail: https://cli.vuejs.org/config/#publicpath
       */
      publicPath: '', // publicPath:''
      outputDir: 'dist',
      assetsDir: 'static',
      lintOnSave: process.env.NODE_ENV === 'development',
      productionSourceMap: false,
    

    productionSourceMap 已经配置过了

    在非 prod 模式下打包的

    5 条回复    2020-12-28 17:47:43 +08:00
    liyang5945
        1
    liyang5945  
       2020-12-28 17:14:26 +08:00
    这种情况你需要打包成 测试环境 API prod 模式的
    TomVista
        2
    TomVista  
       2020-12-28 17:16:45 +08:00
    你这看着好像是 vue 刚刚开始学的样子?

    搞定这个问题,需要把 vue 前端用的东西串一遍 node webpack babel loader 什么的,直接给你几行代码搞定也不现实

    建议用 vue-cli 默认配置重新建项目,然后把你的代码复制过去,打包什么的都不用配置,直接 build 就行,其他的东西一边写一边学
    xiaohantx
        3
    xiaohantx  
    OP
       2020-12-28 17:21:57 +08:00
    @liyang5945 我用的 npm run build:dev
    waiaan
        4
    waiaan  
       2020-12-28 17:30:13 +08:00
    npm run build:prod
    xiaohantx
        5
    xiaohantx  
    OP
       2020-12-28 17:47:43 +08:00
    @waiaan emmm 我意思用别的模式但是不生成这么多
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3041 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:11 · PVG 19:11 · LAX 04:11 · JFK 07:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.