How to force webpack to use multiple urls for publicPath config
I know that in webpack you can set publicPath to the cdn url like this:
// Example CDN
output: {
path: "/home/proj/cdn/assets/[hash]",
publicPath: "http://cdn.example.com/assets/[hash]/"
}
but how do you do the trick of having multiple CDN aliases to improve performance?
eg:
- http://cdn1.example.com
- http://cdn2.example.com
- http://cdn3.example.com
- http://cdn4.example.com
+3
Christian schlensker
source
to share
1 answer
I don't think the webpack supports this yet. I quickly looked at the source and it seemed to be expecting a static value. You should probably open the problem if you don't find the file in question.
As a temporary hack, you can try something a little clever. Set publicPath
for something that is easy to replace. Then, using another script, detect and perform the replacement according to your logic. This might be a good solution for now.
+1
Juho VepsΓ€lΓ€inen
source
to share