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:

+3


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


source







All Articles