Fix issue with TypeScript paths with allowJs - #470
Conversation
|
Another thing, I wasn't sure whether i should only add |
Codecov Report
@@ Coverage Diff @@
## master #470 +/- ##
==========================================
+ Coverage 74.68% 74.93% +0.25%
==========================================
Files 13 13
Lines 395 399 +4
==========================================
+ Hits 295 299 +4
Misses 100 100
Continue to review full report at Codecov.
|
| // error if there's no tsconfig in the working directory | ||
| try { | ||
| resolvePlugins.push(new TsconfigPathsPlugin({ silent: true })); | ||
| resolvePlugins.push(new TsconfigPathsPlugin({ silent: true, extensions: [".ts", ".tsx", ".js"] })); |
There was a problem hiding this comment.
| resolvePlugins.push(new TsconfigPathsPlugin({ silent: true, extensions: [".ts", ".tsx", ".js"] })); | |
| resolvePlugins.push(new TsconfigPathsPlugin({ silent: true, extensions: SUPPORTED_EXTENSIONS })); |
The docs mention that these should be the same.
Perhaps this should look for allowJs option before assigning the extensions.
If you're using allowJs in tsconfig.json, or allow other non-TS extensions in webpack, make sure you set extensions option in sync with your webpack config.
There was a problem hiding this comment.
@styfle I believe I addressed both your suggestions, I did it in two steps, let me know if you want to keep the check against the tsconfig.json
3e37e30 to
9cd8306
Compare
allowJs
Closes #469
I noticed something when I added the test, when you run the existing
output.jsoftsconfig-pathsyou also get "Cannot find module", not sure if the output there is intended to be different fromoutput-coverage.js, but thought i'd point it out.The
tsconfig-paths-allowjs/output-coverage.jsshows the difference between addingjsto the extensions ofTsconfigPathsPluginand not having it.