Skip to content
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

Import gets not added #463

Open
tujoworker opened this issue Oct 12, 2017 · 3 comments
Open

Import gets not added #463

tujoworker opened this issue Oct 12, 2017 · 3 comments

Comments

@tujoworker
Copy link

tujoworker commented Oct 12, 2017

Hi!

thanks for making this great tool!
I found that there is happening something strange.

I made a test repo: https://github.com/tujoworker/import-js-bug

git clone https://github.com/tujoworker/import-js-bug
cd import-js-bug
npm install

I use Atom Editor with the package "import-js" installed.

Once I try to index the sqlite database with the dependencies, noting than the index.js gets added.
But once I go into ./node_modules/react-anime/package.json and change:

"main": "dist/anime.min.js",
to (without .min)
"main": "dist/anime.js",

... and I rerun the process to index the database, 'react-anime' gets added. Unfortunately with the name 'reactanime' (Where is this coming from?).

I would be happy if someone knows why the .min version is not supported.

Cordial,

Tobias

@trotzig
Copy link
Collaborator

trotzig commented Oct 13, 2017

Unfortunately with the name 'reactanime' (Where is this coming from?).

This is the normalized name that we use to match against variable names. It will for match things like ReactAnime & reactAnime. You can make it match Anime as well by adding react- to the ignorePackagePrefixes config option.

The fact that the main isn't properly being indexed is probably because the dist/anime.min.js is minified, and our code to detect exports isn't properly handling this. If you want to help fix this, a good starting point is to add a failing test to https://github.com/Galooshi/import-js/blob/master/lib/__tests__/findExports-test.js. Even if you can't fix the bug, a test case reproducing the issue will help a lot when writing a fix.

@tujoworker
Copy link
Author

Nice, thanks so long.
What is the best practise link / run this package locally to change and test code? I use Atom (apm link), but maybe this is not the best practise, and a cli setup is better?

@trotzig
Copy link
Collaborator

trotzig commented Oct 16, 2017

I haven't done much simultaneous development on import-js and atom-import-js at the same time. apm link and npm link might do the trick, you can also try the vim plugin or the sublime plugin, they both use the command-line tool under the hood (atom-import-js doesn't) so an npm link in the import-js project should be enough.

In this case, I think you can TDD the thing and call it done. That's what we've done in other cases when things haven't been properly indexed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants