How to set a sub-path and CDN for assets simultaneously in vue-cli 3.3+?

Viewed 123

My team's working on a vue project which will use sub-path. Our domain is https://a.exampl.com, we are using this project with https://a.example.com/b. Now, we want to upload assets to cloud after webpack building and change assets to CDN's link which is different from sub-path, such as https://cdn.example.com. My vue.config.js like following:

// vue.config.js
const vueConfig = {
  publicPath: './b',
  configureWebpack: {
    plugins: []
  }
}

Versions:

  • vue-cli: 4.4.6
  • Webpack: 4.44.1

So how can I modify the vue.config.js settings to implement that the project could use https://a.example.com/b and assets could use the cdn like https://cdn.example.com?

0 Answers
Related