最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue項目打包:修改dist文件名方式

 更新時間:2022年12月05日 09:38:32   作者:藍(lán)胖子的多啦A夢  
這篇文章主要介紹了vue項目打包:修改dist文件名方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

vue項目打包:修改dist文件名

vue.config.js

?// 輸出文件目錄(默認(rèn)dist)
? ?outputDir: 'smf',
'use strict'
const path = require('path')
const defaultSettings = require('./src/settings.js')

function resolve(dir) {
  return path.join(__dirname, dir)
}

const name = defaultSettings.title // 網(wǎng)址標(biāo)題
//const port = 8013 // 端口配置
const port = 8000 // 端口配置
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
  // hash 模式下可使用
  // publicPath: process.env.NODE_ENV === 'development' ? '/' : './',
  publicPath: './',
  outputDir: 'smf',
  assetsDir: 'static',
  lintOnSave: false,
  productionSourceMap: false,
  devServer: {
    port: port,
    open: false,
    overlay: {
      warnings: false,
      errors: true
    },
    proxy: {
      '/api': {
        target: process.env.VUE_APP_BASE_API,
        changeOrigin: true,
        pathRewrite: {
          '^/api': 'api'
        }
      },
      '/auth': {
        target: process.env.VUE_APP_BASE_API,
        changeOrigin: true,
        pathRewrite: {
          '^/auth': 'auth'
        }
      }
    }
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: name,
    resolve: {
      alias: {
        '@': resolve('src'),
        '@crud': resolve('src/components/Crud')
      }
    }
  },
  chainWebpack(config) {
    config.plugins.delete('preload') // TODO: need test
    config.plugins.delete('prefetch') // TODO: need test

    // set svg-sprite-loader
    config.module
      .rule('svg')
      .exclude.add(resolve('src/assets/icons'))
      .end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/assets/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]',

      })

      .end()

    // set preserveWhitespace
    config.module
      .rule('vue')
      .use('vue-loader')
      .loader('vue-loader')
      .tap(options => {
        options.compilerOptions.preserveWhitespace = true
        return options
      })
      .end()

    config
      // https://webpack.js.org/configuration/devtool/#development
      .when(process.env.NODE_ENV === 'development',
        // config => config.devtool('cheap-source-map')
        config => config
      )

    config
      .when(process.env.NODE_ENV !== 'development',
        config => {
          config
            .plugin('ScriptExtHtmlWebpackPlugin')
            .after('html')
            .use('script-ext-html-webpack-plugin', [{
              // `runtime` must same as runtimeChunk name. default is `runtime`
              inline: /runtime\..*\.js$/
            }])
            .end()
          config
            .optimization.splitChunks({
              chunks: 'all',
              cacheGroups: {
                libs: {
                  name: 'chunk-libs',
                  test: /[\\/]node_modules[\\/]/,
                  priority: 10,
                  chunks: 'initial' // only package third parties that are initially dependent
                },
                elementUI: {
                  name: 'chunk-elementUI', // split elementUI into a single package
                  priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
                  test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
                },
                commons: {
                  name: 'chunk-commons',
                  test: resolve('src/components'), // can customize your rules
                  minChunks: 3, //  minimum common number
                  priority: 5,
                  reuseExistingChunk: true
                }
              }
            })
          config.optimization.runtimeChunk('single')
        }
      )
  },
  transpileDependencies: [
    'vue-echarts',
    'resize-detector'
  ]
}

修改vue打包后的默認(rèn)文件名

問題:因為我想在我的服務(wù)器上部署兩個vue項目,但是vue打包后默認(rèn)的項目名是dist,這樣子就跟我上一個vue項目沖突了。因此查了一下資料。

解決方案

進(jìn)入config ⇒ index.js,在build中將dist關(guān)鍵字改成其他名稱即可。

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue更改數(shù)組中的值實例代碼詳解

    vue更改數(shù)組中的值實例代碼詳解

    這篇文章主要介紹了vue更改數(shù)組中的值,本文通過兩個例子,給大家介紹的非常詳細(xì),具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-02-02
  • vue3實現(xiàn)自定義導(dǎo)航菜單的示例代碼

    vue3實現(xiàn)自定義導(dǎo)航菜單的示例代碼

    這篇文章主要為大家詳細(xì)介紹了如何使用vue3實現(xiàn)自定義導(dǎo)航菜單,文中的示例代碼講解詳細(xì),感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2024-11-11
  • postcss-pxtorem設(shè)置不轉(zhuǎn)換UI框架的CSS單位問題

    postcss-pxtorem設(shè)置不轉(zhuǎn)換UI框架的CSS單位問題

    這篇文章主要介紹了postcss-pxtorem設(shè)置不轉(zhuǎn)換UI框架的CSS單位問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-07-07
  • 通過npm或yarn自動生成vue組件的方法示例

    通過npm或yarn自動生成vue組件的方法示例

    這篇文章主要介紹了通過npm或yarn自動生成vue組件的方法示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-02-02
  • 詳解vue更改頭像功能實現(xiàn)

    詳解vue更改頭像功能實現(xiàn)

    這篇文章主要介紹了vue更改頭像功能實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • vue自定義標(biāo)簽和單頁面多路由的實現(xiàn)代碼

    vue自定義標(biāo)簽和單頁面多路由的實現(xiàn)代碼

    這篇文章主要介紹了vue自定義標(biāo)簽和單頁面多路由的實現(xiàn)代碼,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-05-05
  • Vue?Echarts實現(xiàn)多功能圖表繪制的示例詳解

    Vue?Echarts實現(xiàn)多功能圖表繪制的示例詳解

    作為前端人員,日常圖表、報表、地圖的接觸可謂相當(dāng)頻繁,今天小編隆重退出前端框架之VUE結(jié)合百度echart實現(xiàn)中國地圖+各種圖表的展示與使用;作為“你值得擁有”專欄階段性末篇,值得一看
    2023-02-02
  • Vue 2.0入門基礎(chǔ)知識之內(nèi)部指令詳解

    Vue 2.0入門基礎(chǔ)知識之內(nèi)部指令詳解

    這篇文章主要介紹了Vue 2.0入門基礎(chǔ)知識之內(nèi)部指令知識,非常不錯,具有參考借鑒價值 ,需要的朋友可以參考下
    2017-10-10
  • vue 權(quán)限認(rèn)證token的實現(xiàn)方法

    vue 權(quán)限認(rèn)證token的實現(xiàn)方法

    這篇文章主要介紹了vue 權(quán)限認(rèn)證token的實現(xiàn)方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07
  • vue大型項目之分模塊運行/打包的實現(xiàn)

    vue大型項目之分模塊運行/打包的實現(xiàn)

    這篇文章主要介紹了vue大型項目之分模塊運行/打包的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-09-09

最新評論

青田县| 丹棱县| 丰镇市| 普定县| 桂平市| 中阳县| 富宁县| 建德市| 页游| 虞城县| 清水县| 黑龙江省| 洮南市| 托克逊县| 闸北区| 临邑县| 综艺| 海兴县| 阿鲁科尔沁旗| 秦安县| 米林县| 新河县| 高雄市| 沁水县| 鹤岗市| 裕民县| 甘泉县| 黄平县| 府谷县| 沙洋县| 印江| 田东县| 阳信县| 藁城市| 远安县| 正定县| 冕宁县| 旅游| 东兴市| 高淳县| 郧西县|