Open RHIE-coder opened 7 months ago
There is an error in not parsing the path accurately, depending on the baseUrl value in tsconfig.json.
baseUrl
tsconfig.json
{ ... "compilerOptions": { "baseUrl": "./src/jslib", "paths": { "@/crypto/*": ["crypto/*"], "@/utils/*": ["utils/*"] } "outDir": "./build" } ... }
Correctly find the file to replace and read the baseUrl and path values in tsconfig.json correctly.
However, the .replace('---', '') function does not seem to work.
.replace('---', '')
tsc-alias debug: default replacer - absoluteAliasPath: '---/Users/rhiemh/Workspace/@demo/test-sandbox/build' tsc-alias debug: default replacer - Invalid path tsc-alias debug: base-url replacer - requiredModule: '@/utils/math' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/index.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/crypto/decrypt.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/crypto/encrypt.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/utils/math.js'
{ ... "compilerOptions": { "baseUrl": "./", "paths": { "@/crypto/*": ["./src/jslib/crypto/*"], "@/utils/*": ["./src/jslib/utils/*"] }, "outDir": "./build" } ... }
tsc-alias debug: default replacer - absoluteAliasPath: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/utils' tsc-alias debug: default replacer - relativeAliasPath: './jslib/utils' tsc-alias debug: default replacer - newImportScript: 'require("./jslib/utils/math")' tsc-alias debug: default replacer - modulePath: './jslib/utils/math' tsc-alias debug: base-url replacer - requiredModule: './jslib/utils/math' tsc-alias debug: base-url replacer - already resolved tsc-alias debug: replaced file with changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/index.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/utils/math.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/crypto/decrypt.js' tsc-alias debug: replaced file without changes: '/Users/rhiemh/Workspace/@demo/test-sandbox/build/src/jslib/crypto/encrypt.js'
As you can see, both 'Error Case' and 'Success Case' have the same path, but they behave differently depending on the combination of baseUrl and path.
path
Am I doing something wrong or is it a bug?
Thanks!
Best regards.
There is an error in not parsing the path accurately, depending on the
baseUrl
value intsconfig.json
.Error Case
tsconfig.json
Problem found with debug
Correctly find the file to replace and read the baseUrl and path values in tsconfig.json correctly.
However, the
.replace('---', '')
function does not seem to work.Success Case
tsconfig.json
Debug result
Issue Conclusion
As you can see, both 'Error Case' and 'Success Case' have the same path, but they behave differently depending on the combination of
baseUrl
andpath
.Am I doing something wrong or is it a bug?
Thanks!
Best regards.