shirotech / webpack-cdn-plugin

A webpack plugin that use externals of CDN urls for production and local node_modules for development
MIT License
343 stars 41 forks source link

import('axios').then and optimize:true will inject axios cdn in html #84

Open yinsang opened 3 years ago

yinsang commented 3 years ago

use react、 react-router and webpack-cdn-plugin。 mainPage not have axios,pageB use axios to fetch sth.

import('axios').then()

While mainPage load CDN axios.min.js is useless.

now : dist/index has CDN of axios, both /mainPage and /pageB use it. Expect: /mainPage not have CDN of axios, /pageB load bundle of axios like 1.[hash].js or CDN axios, and then fetch sth. so , mainPage can have a better TTI. demo here, need your response, Please. cdn-plugin-bug.zip

new WebpackCdnPlugin(
      {
        optimize: true,
        modules: [
          { name: 'axios', var: 'axios', prodUrl: 'https://g.alicdn.com/code/lib/axios/0.21.1/axios.min.js' },
        ]
      }
    )
yinsang commented 3 years ago

need response