-
Notifications
You must be signed in to change notification settings - Fork 378
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
Resolve .jsx files #826
base: master
Are you sure you want to change the base?
Resolve .jsx files #826
Conversation
If you wish to ignore .jsx files, you can explicitly define that in a regex in the dontLoad option
I tried this, but I can't get it to work. What does your |
@@ -116,7 +116,7 @@ | |||
var path = parentFile ? resolvePath(dirName(parentFile), word) : baseName(word) | |||
for (var prop in this.modules) { | |||
if (prop != parentFile && filter(path, prop, query)) { | |||
if (/\.js$/.test(prop)) prop = prop.slice(0, prop.length - 3) | |||
if (/\.jsx?$/.test(prop)) prop = prop.slice(0, prop.length - 3) |
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.
There must be prop.length - 4 because length(".jsx") = 4.
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.
It can be either 3 or 4, so jou would need two different if statements
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.
and 'else if' is also appreciated because it won't work with "foo.jsx.js" file name.
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.
Preferably, just store the regexp match and use match[0].length
to get its actual length
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.
I found replace to work well here:
e.g.
prop = prop.replace(/.jsx?/, '')
Hi! |
@marijnh Can I help with something ... maybe update PR? I really like tern and would like to use it :) |
I just used the webpack plugin as I use that anyway, so I didn't have a need for this anymore. |
@JelteF can you describe it more? So my .tern-project files looks like this:
webpack.config:
Webpack plugin helps tern resolve webpack's aliases, but tern still doesn't see .jsx files. Though it became to see them after .jsx files got edited and saved. |
If you wish to ignore .jsx files, you can explicitly define that in a regex in the dontLoad option