Remove inline sourcemap if largeFile is activated
See original GitHub issueUsing the following gulp pipeline, I’m facing the issue that the resulting bundle still contains the inline sourcemap, which was generated by rollupjs (more precise rollup-stream). At the same time the external sourcemap file is generated, written to directory and linked in the app.js-file correctly. If I deactivate the largeFile option, the result is the same, but the inline sourcemap becomes removed from my app.js-file, which is the behavour I would expect. Unfortunately, I cannot deactivate the largeFile option for my project, because the regex that is used by convert-source-map otherwise causes the build to crash due to a “Maximum call stack size exceeded” error.
My pipeline:
return rollup({
entry: paths.src.mainAotJsFile,
sourceMap: true,
context: 'window',
treeshake: true,
format: 'cjs',
plugins: rollupPlugins
})
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({largeFile: false, loadMaps: true}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.dist.bundledDir));
I already had a short look into the code of gulp-sourcemaps and into the code of convert-source-map. Unfortunately, the seen behavior is a valid implementation, because the function that removes the inline sourcemap usually is based on the regex that tends to cause a “Maximum call stack size exceeded” error with large files 😕
I would be very happy, if we could find a smart solution for this problem 😃
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@nmccready it looks like someone “improved” the RegExp to be less greedy (my terminology might be incorrect here) so that it realizes it doesn’t match early and avoids blowing the stack but they removed the lastIndex stuff at the same time. Hopefully I hear back from them sooner than later.
@phated I had a try with the current versions. Unfortunately, I’m facing the same results as described in my initial post…