Open Koiix opened 4 years ago
A candidate replacement regex might be:
/(?:\/\*(?:\s*(?:\/\/)?)?(?:[#@] sourceMappingURL=([^\s'"]*))\s*\*\/|\/\/(?:[#@] sourceMappingURL=([^\s'"]*)))\s*(?=([^"']*"[^'"]*")*[^'"]*$)(?=([^"']*"[^'"]*")*[^'"]*$)/
Hi! I’d recommend not using this package. Here are some alternatives:
For example, if we had:
const sourceMappingURL = require('source-map-url');
const code = 'console.log("//# sourceMappingURL=index.js.map")';
sourceMappingURL.removeFrom(code);
There is no SourceMappingURL comment in the piece of code, but the current build would remove the string contents in the code segment.