I am using vue cli 3
and here is my vue.config.js
:
const path = require('path')
const webpack = require('webpack')
const publicDir = 'public'
const isProduction = process.env.NODE_ENV === 'production'
module.exports = {
publicPath: isProduction ? './dist/' : '',
outputDir: 'public/dist',
indexPath: '../../resources/views/index.blade.php',
filenameHashing: true,
chainWebpack: config => {
config
.entry('app')
.clear()
.add('./resources/vue/main.js')
.end()
config.module
.rule('graphql')
.test(/\.gql$/)
.use('graphql-tag/loader')
.loader('graphql-tag/loader')
.end()
},
configureWebpack: {
plugins: [new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)]
}
}
I need to delete some files after build for production and I don't know how to detect the build process is over.
I didn't find any documentation on this.
You can do that in your package.json
file. You can add your custom script or the modify existing one.
For example take a look at the clean script. You can call this script manually, or add it in another script. In this example it is executed when build script is executed:
"scripts": {
"serve": "vue-cli-service serve",
"watch": "vue-cli-service build --mode development --watch",
"dev": "vue-cli-service --mode development build",
"build": "vue-cli-service build && npm run clean",
"lint": "vue-cli-service lint",
"clean": "rm -rf ../public/dist"
},
...
NOTE: &&
makes them run sequentially clean
will run after build
.