Skip to content

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

@Amberg

Description

@Amberg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions