use react、 react-router and webpack-cdn-plugin。
mainPage not have axios,pageB use axios to fetch sth.
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' },
]
}
)