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

vue項(xiàng)目中使用rimraf?dev啟動(dòng)時(shí)刪除dist目錄方式

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

使用rimraf dev啟動(dòng)時(shí)刪除dist目錄

適用 vue 2.x vue 3.x已經(jīng)會(huì)在啟動(dòng)時(shí)自動(dò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目錄

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

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

相關(guān)文章

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

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

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

    element-ui select多選綁定回顯值問(wèn)題

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

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

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

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

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

    vue中使用swiper失效問(wèn)題及解決

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

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

    vue項(xiàng)目中點(diǎn)擊router-link標(biāo)簽鏈接都屬于聲明式導(dǎo)航。vue項(xiàng)目中編程式導(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)換位置)

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

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

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

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

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

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

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

最新評(píng)論

绥化市| 梅州市| 黄山市| 迁西县| 叙永县| 博白县| 阿克陶县| 井陉县| 且末县| 邢台市| 亚东县| 乌拉特后旗| 江孜县| 郓城县| 临武县| 广丰县| 社会| 兰考县| 孙吴县| 广安市| 静乐县| 五大连池市| 冀州市| 拜泉县| 从江县| 南川市| 云南省| 临猗县| 繁昌县| 靖远县| 云和县| 清涧县| 天镇县| 大丰市| 寿宁县| 县级市| 五指山市| 文安县| 常山县| 盐边县| 定安县|