Using vue-cli, to bring in resources in the development environment using import, and using cdn in the production environment to introduce the resources you need, what should you do?

what should I do if I use vue-cli, to bring in resources in the development environment using import, and in the production environment to use cdn to introduce the resources I need?

May.11,2021

index.js, of config folder modifies build configuration item:

module.exports = {
    dev: {
        // ...
        assetsSubDirectory: 'static',
        assetsPublicPath: '/',
        // ...
    },
    build: {
        // ...
        assetsRoot: path.resolve(__dirname, '../../dist'),
        assetsSubDirectory: 'static',
        assetsPublicPath: `${settings.cdn}/`,
        // ...
    }
}
Menu