-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
|
src/index.js
Outdated
@@ -71,7 +71,7 @@ module.exports = ( | |||
// we need to catch here because the plugin will | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Closes #469
I noticed something when I added the test, when you run the existing
output.js
oftsconfig-paths
you 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.js
shows the difference between addingjs
to the extensions ofTsconfigPathsPlugin
and not having it.