PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Unable to find tns-core-modules when used with angular. #198

Closed ldavidson closed 4 years ago

ldavidson commented 5 years ago

running "tns run android --bundle" getting errors and drop down is not showing: but seems to be fine in the playground.

ERROR in node_modules/nativescript-drop-down/drop-down.d.ts(16,33): error TS2307: Cannot find module 'data/observable-array'.
node_modules/nativescript-drop-down/drop-down.d.ts(17,62): error TS2307: Cannot find module 'ui/core/view'.
node_modules/nativescript-drop-down/drop-down.d.ts(18,30): error TS2307: Cannot find module 'ui/gestures/gestures'.
node_modules/nativescript-drop-down/drop-down.d.ts(19,29): error TS2307: Cannot find module 'ui/list-picker'.

I have worked around this by adding "tns-core-moduels/" in front of all requires in all files that are referencing tns-core-modules items. this includes:

PeterStaev commented 5 years ago

Hey @ldavidson , this is because you need to have the following in your typescript.json: https://github.com/PeterStaev/NativeScript-Drop-Down/blob/d345ab293a9fb24e3b62fd2f362d2c19addebcd4/demo-ng/tsconfig.json#L15-L19

I am aware that the {N} core team is depreciating those short import paths and are pushing all devs to write the full path which seems ridiculous as you have to type an additional 31 symbols for every import. You can read more details on the suggestions here: https://github.com/NativeScript/NativeScript/issues/4041#issuecomment-465477508

So for the time being I'm not going to take any actions on fixing this, until the core team decides how will they proceed with this. Will leave the issue open until then.

ldavidson commented 5 years ago

Thank you @PeterStaev, Yes that stinks especially for really long imports.

carrbrpoa commented 5 years ago

Hi @PeterStaev, just modifying tsconfig.json should fix it? I think it only worked when I manually modified imports like @ldavidson did.

PeterStaev commented 5 years ago

@carrbrpoa , yes, adding the paths in tsconfig.json should fix the problem. I never had problems with any of my plugins (as all use short import paths 😄 ) even if the projects were upgraded to TNS 5.2. You might get warnings that short import paths are depreciated but the apps are working fine.

edusperoni commented 5 years ago

I'll open a PR to fix this. Short imports are deprecated

PeterStaev commented 5 years ago

Hey @edusperoni , this is intentionally marked as wontfix 😉

I'm well aware that the {N} core team is depreciating those short import paths and are pushing all devs to write the full. But this seems ridiculous as you have to type an additional 31 symbols for every import. You can read more details on the discussion/suggestions here: https://github.com/NativeScript/NativeScript/issues/4041.

For all of my plugins I'm not going to fix the short imports until the core team implements a better solution for this. So I urge you to 👍 and comment on the above mentioned issue.

edusperoni commented 5 years ago

I absolutely agree with you on that front, and would rather use @nativescript/core. The problem is that this plugin will need a workaround to work with new NativeScript releases. This is a discussion worth having, but I don't believe hindering the developer experience over 31 symbols is the correct approach to all this, so I'm asking you to reconsider.

This may be a stupid decision, but let's please not get into a battle of egos :)

PeterStaev commented 5 years ago

I do not consider this hindering. The plugin works perfectly fine even with short imports.

RajkumarRepo commented 5 years ago

I'm also facing the same issue

PeterStaev commented 4 years ago

This is now fixed in the new version of the plugin available in the ProPlugins NPM registry. It uses the new scoped packages instead of the tns-core-modules

All future work of this plugin will be available exclusively as part of ProPlugins initiative. So if you want to get the latest updates/fixes/features make sure you subscribe to the service. You get all my plugins plus many of the most used and high quality plugins for a small monthly subscription fee.

edusperoni commented 4 years ago

I'd like to ask you to please reopen this as it's not fixed in the public repo. I should get around to opening a PR to fix this eventually.

PeterStaev commented 4 years ago

Hey @edusperoni , I prefer to leave this closed, although it is not fixed on the public repo. This will give indication to users that if they want they can get the fix on ProPlugins.

Still feel free to submit a PR and I would gladly merge it in the public repo.

Merry Christmas!

edusperoni commented 4 years ago

Doesn't the private plugin have a private repo with its own issue tracker? This issue is still open on this repo and on this npm package.

Hindering this repo and treating as a second class citizen as an ad to ProPlugins doesn't seem very fair.

Merry Christmas to you too!

FlavioShift3 commented 4 years ago

In my case TSConfig.json was like this and get error:

"baseUrl": "./src",
        "paths": {
            "*": [
                "./node_modules/tns-core-modules/*",
                "./node_modules/*"
            ],

I added one more dot before /node_modules and all back to work:

"baseUrl": "./src",
        "paths": {
            "*": [
                "../node_modules/tns-core-modules/*",
                "../node_modules/*"
            ],