'When integrating old nativescript libraries throws Module not found: Error: Can't resolve 'tns-core-modules/application'
When trying to install the [Razor Pay library][1] [1]: https://www.npmjs.com/package/nativescript-razorpay, I get the following error:
ERROR in ./node_modules/nativescript-razorpay/razorpay.android.js 3:20-59 Module not found: Error: Can't resolve 'tns-core-modules/application' resolve 'tns-core-modules/application' Parsed request is a module
Does anyone know what can be done to resolve this error? Or do we need to rewrite the plugin to the newest version of the nativescript, in order for this to run?
Solution 1:[1]
You can find your answer here: https://blog.nativescript.org/nativescript-7-for-plugin-authors/
basically you should change
'tns-core-modules/application'
to this
'@nativescript/core'
Solution 2:[2]
I found out that most likely doesn't need a full rewrite, just a few import updates for ns7/8 to use @nativescript/core imports.
You may be able to get it working with a webpack alias as well - though ideally the plugin should be updated...
webpack.chainWebpack(config => {
config.resolve.alias.set('tns-core-modules', '@nativescript/core')
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | oded bartov |
| Solution 2 | Kamil Kafoor |
