You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configuration Languages: TS_NODE_PROJECT not working #2733
@EugeneHlushko yes it's working.
But there is another problem with it: webpack.config.json uses global environments and when I use cross-env TS_NODE_PROJECT=... one of my webpack configs conmpiled incorrectly, because I have different tsconfig.json's as well.
The tsconfig.json file on the root level is used by my IDE and tslint for linting the entire project.
The tools/tsconfig-for-webpack-config.json file is only used to run webpack.config.ts and test/testProductionBuild.ts
Hi there. I have a .ts config in two different projects one is with the following versions:
"webpack": "^4.29.0",
"webpack-cli": "^3.2.1"
and the other is with the following versions:
"webpack": "^4.31.0",
"webpack-cli": "^3.3.2"
But for the first one I don't need to add TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\" but for the second one, it's required. I think that it's better to make it work without this additional stuff.
@aryzing, though this is an old issue, maybe this would still be useful. I've had the exact same issue and I managed to resolve it by adding delete process.env.TS_NODE_PROJECT; at the top of my webbacp.config.ts as suggested in jonaskello/tsconfig-paths-webpack-plugin#17. This hack basically clears the TS_NODE_PROJECT variable for any code inside the config, including ts-loader which will then use the default tsconfig.json.
Activity
SeanPercy commentedon Jan 11, 2019
@akopchinskiy I faced a similar issue. The following worked for me:
npm i cross-env"build": "cross-env TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\" webpack"EugeneHlushko commentedon Jan 14, 2019
@akopchinskiy can you confirm that adding
cross-envlike Sean suggests solves your issue?akopchinskiy commentedon Jan 14, 2019
@EugeneHlushko yes it's working.
But there is another problem with it:
webpack.config.jsonuses global environments and when I usecross-env TS_NODE_PROJECT=...one of my webpack configs conmpiled incorrectly, because I have differenttsconfig.json's as well.SeanPercy commentedon Jan 14, 2019
@akopchinskiy I guess you mean something like setting the mode to production / development, right?
This is my folder structure:
And here is an excerpt of my package.json
The
tsconfig.jsonfile on the root level is used by my IDE andtslintfor linting the entire project.The
tools/tsconfig-for-webpack-config.jsonfile is only used to runwebpack.config.tsandtest/testProductionBuild.tshakobpogh commentedon May 15, 2019
Hi there. I have a
.tsconfig in two different projects one is with the following versions:and the other is with the following versions:
But for the first one I don't need to add
TS_NODE_PROJECT=\"tsconfig-for-webpack-config.json\"but for the second one, it's required. I think that it's better to make it work without this additional stuff.aryzing commentedon Aug 24, 2019
@hakobpogh how, then, can you use different TypeScript configs for webpack and for your code?
eduard-malakhov commentedon May 1, 2020
@aryzing, though this is an old issue, maybe this would still be useful. I've had the exact same issue and I managed to resolve it by adding
delete process.env.TS_NODE_PROJECT;at the top of mywebbacp.config.tsas suggested in jonaskello/tsconfig-paths-webpack-plugin#17. This hack basically clears theTS_NODE_PROJECTvariable for any code inside the config, includingts-loaderwhich will then use the defaulttsconfig.json.wrightwriter commentedon Aug 18, 2023
I solved this by modifying my tsconfig as per the docs