- 
                Notifications
    
You must be signed in to change notification settings  - Fork 65
 
Open
Labels
Description
If a custom config for the webpack.SourceMapDevToolPlugin is used and the output.publicPath is set in the webpack config, the logic that adjusts the source map url breaks it:
Configuration
const { SourceMapDevToolPlugin } = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin");
module.exports = {
  devtool: false,
  output: {
    publicPath: "/foo/bar"
  },
  plugins: [
    new HtmlWebpackPlugin({ inlineSource: ".(js|css)$" }),
    new HtmlWebpackInlineSourcePlugin(),
    new SourceMapDevToolPlugin({
      filename: "[file].map",
      append: `\n//# sourceMappingURL=https://example.com/[file].map`
    })
  ]
};Current Output
//# sourceMappingURL=/foo/bar/https:/example.com/main.js.mapExpected Output
//# sourceMappingURL=https://example.com/main.js.mapReproduction repo: https://github.com/gribnoysup/html-webpack-inline-source-plugin-with-custom-sourcemap
Looking at the initial issue and the PR that introduced this sourceMappingURL processing, seems like it will in general work only with the assumption that your index.html and all the other assets are served from the same domain and with the same folder structure for the assets, so it would be nice to be able to opt out as this is not the only case possible especially with the more custom webpack configurations.