vue-cli3.0, the path configuration of the production environment is different from that of the development environment.
is configured like 2.0,3.0 has
// vue.config.js
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === "production") {
// ...
} else {
// ...
}
}
}
forgive me for being very low,. What should I do if I want to configure baseUrl,assetsDir items in it? I have tried,
config.baseUrl =" * ", will report an error.
also, when I configure the production environment,
baseUrl: "../",
//
outputDir: "dist/resources",
indexPath:"./templates/login.html",
// (js/css/img/font/...)
assetsDir: "./static",
filenameHashing:false
specify a folder, which is a server file, in which there are other files such as xml. Packing will empty the folder. Is there any way to do it? This has been resolved, and there is a no-clean parameter configuration.
/ / there is also a problem, spring server, static resources are in the static folder, but when accessing, the path does not need / static, is there any way to dynamically configure it?
Last question, it is a bit dizzy to configure es6 support in vue-cli3. For example, I want to use async syntax, how to configure it.
module.exports = {
presets: ["@vue/app"]
};
this means that webpack automatically detects syntax and loads the corresponding Polyfill. But some need to be configured manually, and which ones need to be configured manually
the great gods have summed up the following
1. Multi-environment configuration
// vue.config.js
module.exports = {
// VueCLI3webpackVue CLI
baseUrl: process.env.NODE_ENV === "production"
? "/production-sub-path/"
: "/",
configureWebpack: config => {
// webpackbaseUrl
if (process.env.NODE_ENV === "production") {
// ...
} else {
// ...
}
}
}
2. If you want more detailed configuration, you can
module.exports = {
chainWebpack: config => {
}
}
you can configure alias,load
3. For the problem of emptying the outputDir folder, you can add the no-clean parameter to the build command.
4.es6 support, vue-cli3 dynamic matching, promise,async and other syntax. For some instance methods, you need to manually Polyfill to support