I`m using babel & terser in grunt. Both of them generate sourceMaps. Babel has to be executed first, so it's sourceMap should be an inputSoruceMap for terser.
I've found something similar on stackoverflow:
babel: {
dist: {
options: {
sourceMap: true,
inputSourceMap: grunt.file.readJSON('script.js.map')
},
src: [
'script.js',
],
dest: 'app.js'
}
}
but it's only one file. In my case I have a list of files:
terser: {
options: {
sourceMap: true,
},
dist: {
files: [{
expand: true,
cwd: 'build/scripts/',
src: ['**/*.js'],
dest: 'build/scripts/'
}]
}
}
How to add a source maps in terser in this case? It isn't a single file. It's another file for each script (script_file_name + '.map'). How to do it?