2 years ago

#75101

test-img

adardesign

sourceMaps JS relative path via webpack 4

trying to get a sourceMaps and webpack (v4.46.0) to work with a script that is to be served on various sites (on pages with the same path) and the path to the script is not in the root

For example The script will reside at <url>/unified/<appName>/1.0.0/js/bundle.main.js the source map will reside in the same directory

I don’t want to hard code the absolute URL

The problem is that whatever I do the source map is not picked up and applied (yes, I have enabled it on chrome)

here is the webpack code:

 
plugins: [
...
  new webpack.SourceMapDevToolPlugin({
     filename: '[file].map', 
     append: `\n//# sourceMappingURL=/unified/${app}/${version}/js/[url]`,
     sourceRoot: ``,
     fileContext: ``,
  }),
 ...
]       

webpack

relative-path

source-maps

0 Answers

Your Answer

Accepted video resources