diff --git a/index.js b/index.js index 0d3274b..55efe84 100644 --- a/index.js +++ b/index.js @@ -3,8 +3,7 @@ const path = require("path"); const fs = require('fs'); function stripJsonComments (data) { - const re = new RegExp("\/\/(.*)","g"); - return data.replace(re,''); + return data.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m); } module.exports = (relativeTsconfigPath = './tsconfig.json') => { diff --git a/package.json b/package.json index cee0447..e5c1c0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "esbuild-ts-paths", - "version": "1.1.0", + "version": "1.1.1", "description": "Transform TS path alias to absolute paths for esbuild", "main": "index.js", "repository": "git@github.com:frankleng/esbuild-ts-paths.git",