0

I am struggling with the combination of multiple javascript files and their source maps.

The problem is: I use Google Closure Compiler to obfuscate two javascript files A and B, with generated source maps A.map and B.map. Since I apply different compilation options on them, so compiling A and B into a single file does not work for me. Now, I want to combine A and B to AB, and also combine A.map and B.map into AB.map.

How should I do this? Any existing tools suitable for this purpose?

Aliu
  • 99
  • 9
  • here are some: https://www.npmjs.com/package/source-map-concat , https://www.npmjs.com/package/grunt-concat-sourcemap , https://github.com/mikach/gulp-concat-sourcemap – BhavO Aug 08 '15 at 21:51

2 Answers2

0

There are a number of packages out there that will do the job for example with the grunt-concat-sourcemap package for node you can do the following:

grunt.initConfig({
  concat_sourcemap: {
    options: {},
    target: {
      files: {
        'dest/out.js': ['src/a.js', 'src/b.js']
      }
    }
  }
})

this will concatenate the two specified source files(in order), and write the output to dest/out.js and dest/out.js.map

here are some links to packages for grunt, gulp and plain node:

https://www.npmjs.com/package/grunt-concat-sourcemap

https://github.com/mikach/gulp-concat-sourcemap

https://www.npmjs.com/package/source-map-concat

BhavO
  • 2,406
  • 1
  • 11
  • 13
0

try remapping, @babel/core use it for transform inputSourceMap

D.H.Lolo
  • 53
  • 4