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

vue項目中使用rimraf?dev啟動時刪除dist目錄方式

 更新時間:2022年04月06日 08:39:05   作者:yangdongnan  
這篇文章主要介紹了vue項目中使用rimraf?dev啟動時刪除dist目錄方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

使用rimraf dev啟動時刪除dist目錄

適用 vue 2.x vue 3.x已經(jīng)會在啟動時自動刪除dist目錄

webpack.dev.conf.js

'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const rm = require('rimraf')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
//刪除dist目錄
rm(path.resolve(__dirname, '../dist'),err =>{
  if(err) throw err
})
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: config.dev.devtool,
  // these devServer options should be customized in /config/index.js
  devServer: {
    clientLogLevel: 'warning',
    historyApiFallback: {
      rewrites: [
        { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
      ],
    },
    hot: true,
    contentBase: false, // since we use CopyWebpackPlugin.
    compress: true,
    host: HOST || config.dev.host,
    port: PORT || config.dev.port,
    open: config.dev.autoOpenBrowser,
    overlay: config.dev.errorOverlay
      ? { warnings: false, errors: true }
      : false,
    publicPath: config.dev.assetsPublicPath,
    proxy: config.dev.proxyTable,
    quiet: true, // necessary for FriendlyErrorsPlugin
    watchOptions: {
      poll: config.dev.poll,
    }
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env': require('../config/dev.env')
    }),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
    new webpack.NoEmitOnErrorsPlugin(),
    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true
    }),
    // copy custom static assets
    new CopyWebpackPlugin([
      {
        from: path.resolve(__dirname, '../static'),
        to: config.dev.assetsSubDirectory,
        ignore: ['.*']
      }
    ]),
  ]
})
module.exports = new Promise((resolve, reject) => {
  portfinder.basePort = process.env.PORT || config.dev.port
  portfinder.getPort((err, port) => {
    if (err) {
      reject(err)
    } else {
      // publish the new Port, necessary for e2e tests
      process.env.PORT = port
      // add port to devServer config
      devWebpackConfig.devServer.port = port
      // Add FriendlyErrorsPlugin
      devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
        compilationSuccessInfo: {
          messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
        },
        onErrors: config.dev.notifyOnErrors
        ? utils.createNotifierCallback()
        : undefined
      }))
      resolve(devWebpackConfig)
    }
  })
})

vue修改dist目錄

前后端分析之后,前端 打包處理 

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

相關(guān)文章

  • Vue組件如何設(shè)置Props實(shí)例詳解

    Vue組件如何設(shè)置Props實(shí)例詳解

    props主要用于組件的傳值,他的工作就是為了接收外面?zhèn)鬟^來的數(shù)據(jù),與data、el、ref是一個級別的配置項,下面這篇文章主要給大家介紹了關(guān)于Vue組件如何設(shè)置Props的相關(guān)資料,需要的朋友可以參考下
    2022-06-06
  • element-ui select多選綁定回顯值問題

    element-ui select多選綁定回顯值問題

    這篇文章主要介紹了element-ui select多選綁定回顯值問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-04-04
  • 解決vue項目運(yùn)行提示W(wǎng)arnings while compiling.警告的問題

    解決vue項目運(yùn)行提示W(wǎng)arnings while compiling.警告的問題

    這篇文章主要介紹了解決vue項目運(yùn)行提示W(wǎng)arnings while compiling.警告的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • web前端vue之vuex單獨(dú)一文件使用方式實(shí)例詳解

    web前端vue之vuex單獨(dú)一文件使用方式實(shí)例詳解

    Vuex 是一個專為 Vue.js 應(yīng)用程序開發(fā)的狀態(tài)管理模式。這篇文章主要介紹了web前端vue:vuex單獨(dú)一文件使用方式,需要的朋友可以參考下
    2018-01-01
  • vue中使用swiper失效問題及解決

    vue中使用swiper失效問題及解決

    這篇文章主要介紹了vue中使用swiper失效問題及解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-01-01
  • Vue路由跳轉(zhuǎn)方式區(qū)別匯總(push,replace,go)

    Vue路由跳轉(zhuǎn)方式區(qū)別匯總(push,replace,go)

    vue項目中點(diǎn)擊router-link標(biāo)簽鏈接都屬于聲明式導(dǎo)航。vue項目中編程式導(dǎo)航有this.$router.push(),this.$router.replace(),this.$router.go()???????。這篇文章主要介紹了Vue路由跳轉(zhuǎn)方式區(qū)別匯總(push,replace,go)
    2022-12-12
  • vue3 座位選座矩陣布局的實(shí)現(xiàn)方法(可點(diǎn)擊選中拖拽調(diào)換位置)

    vue3 座位選座矩陣布局的實(shí)現(xiàn)方法(可點(diǎn)擊選中拖拽調(diào)換位置)

    由于公司項目需求需要做一個線上設(shè)置考場相關(guān)的座位布局用于給學(xué)生考機(jī)排號考試,實(shí)現(xiàn)教室考場座位布局的矩陣布局,可點(diǎn)擊選中標(biāo)記是否有座無座拖拽調(diào)換位置橫向縱向排列,本文給大家分享實(shí)現(xiàn)代碼,一起看看吧
    2023-11-11
  • vue組件vue-treeselect箭頭和叉圖標(biāo)變大問題及解決

    vue組件vue-treeselect箭頭和叉圖標(biāo)變大問題及解決

    這篇文章主要介紹了vue組件vue-treeselect箭頭和叉圖標(biāo)變大問題及解決方案,具有很好的參考價值,希望對大家有所幫助。
    2022-07-07
  • Vue執(zhí)行流程及渲染示例解析

    Vue執(zhí)行流程及渲染示例解析

    這篇文章主要為大家介紹了Vue執(zhí)行流程及渲染解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-06-06
  • Element el-button 按鈕組件的使用詳解

    Element el-button 按鈕組件的使用詳解

    這篇文章主要介紹了Element el-button 按鈕組件的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-02-02

最新評論

穆棱市| 土默特左旗| 银川市| 昌邑市| 日土县| 满洲里市| 麻栗坡县| 洪洞县| 扎兰屯市| 五寨县| 苏尼特右旗| 东乡族自治县| 逊克县| 舒兰市| 巍山| 贵南县| 大冶市| 泰安市| 石景山区| 玛纳斯县| 兴仁县| 郑州市| 富宁县| 上蔡县| 阜南县| 鄂尔多斯市| 房产| 瑞安市| 涿鹿县| 泉州市| 铜川市| 建昌县| 惠州市| 巫溪县| 图木舒克市| 慈溪市| 滨海县| 邵东县| 普定县| 子长县| 中西区|