Skip to content

Custom injected cdn file location#50

Open
AlexStacker wants to merge 3 commits intoshirotech:masterfrom
AlexStacker:master
Open

Custom injected cdn file location#50
AlexStacker wants to merge 3 commits intoshirotech:masterfrom
AlexStacker:master

Conversation

@AlexStacker
Copy link
Copy Markdown

Add the extra html-webpack-plugin option assetsCdnName:

plugins:[
// ...otherConfig
new HtmlWebpackPlugin({
      title: 'title',
      assetsCdnName: 'cdn',
      favicon: 'path/to/favicon',
      template: 'path/to/template',
      filename: 'filename',
      // other config
 }),
 new WebpackCdnPlugin({
   modules: [
      { name: 'react', var: 'React', path: `dist/react.min.js` },
      { name: 'react-dom', var: 'ReactDOM', path: `dist/react-dom.min.js` },
    ]
 })
]
<% htmlWebpackPlugin.files.cdn.js.forEach(function(link){ %>
    <script src="<%= link %>"></script>
<% }) %>

So I can put the cdn link at the top of all the files.

@shirotech
Copy link
Copy Markdown
Owner

Sorry didn't get to this PR soon enough, are you able to rebase and fix to pass all tests?

@Amberg
Copy link
Copy Markdown

Amberg commented Dec 22, 2020

This feature would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants