Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"/" Added to generated script tags - Invalid script tags #83

Open
Amberg opened this issue Dec 18, 2020 · 0 comments
Open

"/" Added to generated script tags - Invalid script tags #83

Amberg opened this issue Dec 18, 2020 · 0 comments

Comments

@Amberg
Copy link

Amberg commented Dec 18, 2020

Without the CDN plugin the HtmlWebPack plugin creates correct includes:
src="main.js"
If i enable the CDN plugin the generated link is wrong:
src="/main.js" (trailing /)

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const WebpackCdnPlugin = require('webpack-cdn-plugin');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
  plugins: [
    new HtmlWebpackPlugin(),
    new WebpackCdnPlugin({ // this plugins adds a / to the path "<script src="main.js">" --> <script src="/main.js">
        modules: [],
        publicPath: '/node_modules'
      })
  ]
}

I've create a minimal setup to reproduce this bug:
https://github.com/Amberg/cdn-plugin-test

Workaround:
Set the "publicPath" property to "" of the ,HtmlWebPack solves the problem

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

No branches or pull requests

1 participant