Do not publish *.ts file on NPM
Hi, as .ts source files might be imported by mistake (often because of webstorm or VS but not only) it is generally considered a good practice not to include them into the NPM package.
I spent a few minutes searching for the faulty import into my code, I ended up deleting the "rxdb/src" folder to refine the search which directly lead me to the faulty import.
When you delete the src folder, which import suggestions does your IDE give you? Are they correct or are they from the dist-folder?
you can in the meantime prevent it with eslint
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": [
"rxdb/src/**"
],
"message": "RxDB src imports are not allowed"
},
],
}
]
Before deleting:
none is correct.
After deleting I've a mix of 'rxdb' and 'rxdb/dist/types/types' for instance this is what is automatically imported
import {
MangoQuerySelector,
MangoQuerySortDirection,
MangoQuerySortPart,
} from 'rxdb/dist/types/types';
import { MangoQuery } from 'rxdb';
I manually had to change to
import {
MangoQuery,
MangoQuerySelector,
MangoQuerySortDirection,
MangoQuerySortPart,
} from 'rxdb';
To get the imports from the main 'rxdb' bucket properly.
Hmm, so the default import would not be correct anyway, no matter if the src folder is in the package or not. I do not want it to remove it in that case.
There are the correct exports listed in the package.json and I am hoping that the IDEs use that in the future.
It looks like you are using WebStorm, can you try your repo in vscode cause you should have it like so
I do not have Webstorm, only vscode and there the import suggestions are wrong, both with and without having the src folder. I tried several things like removing legacy main/module fields but that did not help.
and I'm not using vscode on my side
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.
Issues are autoclosed after some time. If you still have a problem, make a PR with a test case or to prove that you have tried to fix the problem.