Let's say you have 2 packages, and one of them you want to build with target=es5, another one with target=es6. If you set up ts-loader options to override compiler options (in loader options, not in tsconfig) it wont work properly.
There is a test https://github.com/TypeStrong/ts-loader/tree/main/test/execution-tests/loaderOptions for similar situation, but it doesn't cover this case. Let's say instead of overriding the only getCustomTransformers option you want to override something in compilerOptions. In this case this code will return [object Object] for both different objects (different ref and a value itself) which causes the issue (also this code doesn't cover a case when a value is false, thus if a value is falsy but enabled by default it will also failed).
Not too sure about the fix here. I see different approaches to solve it:
- Use
JSON.stringify for non-functions and value.toString() otherwise
- Allow to provide a
instanceKey or something like that so people can declare their own cache key and refer to them in different places
Maybe you have thoughts how to solve it in better way. Let me know you what do you think. I'm ready to make a fix for this.
Let's say you have 2 packages, and one of them you want to build with target=es5, another one with target=es6. If you set up ts-loader options to override compiler options (in loader options, not in tsconfig) it wont work properly.
There is a test https://github.com/TypeStrong/ts-loader/tree/main/test/execution-tests/loaderOptions for similar situation, but it doesn't cover this case. Let's say instead of overriding the only
getCustomTransformersoption you want to override something incompilerOptions. In this case this code will return[object Object]for both different objects (different ref and a value itself) which causes the issue (also this code doesn't cover a case when a value isfalse, thus if a value is falsy but enabled by default it will also failed).Not too sure about the fix here. I see different approaches to solve it:
JSON.stringifyfor non-functions andvalue.toString()otherwiseinstanceKeyor something like that so people can declare their own cache key and refer to them in different placesMaybe you have thoughts how to solve it in better way. Let me know you what do you think. I'm ready to make a fix for this.