Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
When I run my application using tns preview in my nativescript playground iOS app, with any third party node module include such as @ngx-translate/core, I get the error
Plugin @ngx-translate/core is not included in preview app on device 4F87D793-E6AE-4627-B24C-B84938B4FDBB and will not work.
@ngx-translate is not a nativescript plugin, instead it is just a Angular Module.
To Reproduce
Expected behavior
Sample project
Additional context
@mohammedzamakhan,
NativeScript Preview app is prebuilt with specified set of plugins. In other words, you can use only the prebuilt set of plugins regardless if the plugin is NativeScript plugin or not. This is by design and is fully expected behavior.
If @ngx-translate/core consists only from JavaScript code (without native code), you can use tns preview --bundle. Webpack will traverse your source code, collect all required dependencies and output them in bundle.js which will be transferred on device. So your plugin's code will be available runtime.
im using --bundle but it result:
LOG from device Mrjs: },
LOG from device Mrjs: "status": 404,
LOG from device Mrjs: "statusText": "ERROR",
LOG from device Mrjs: "lazyUpdate": null,
LOG from device Mrjs: "headers": {
LOG from device Mrjs: "normalizedNames": {},
LOG from device Mrjs: "url": "/data/data/org.nativescript.preview/files/app/assets/i18n/en.json",
LOG from device Mrjs: "ok": false,
LOG from device Mrjs: "name": "HttpErrorResponse",
LOG from device Mrjs: "message": "Http failure response for /data/data/org.nativescript.preview/files/app/assets/i18n/en.json: 404 ERROR",
Most helpful comment
@mohammedzamakhan,
NativeScript Preview app is prebuilt with specified set of plugins. In other words, you can use only the prebuilt set of plugins regardless if the plugin is NativeScript plugin or not. This is by design and is fully expected behavior.
If
@ngx-translate/coreconsists only from JavaScript code (without native code), you can usetns preview --bundle. Webpack will traverse your source code, collect all required dependencies and output them inbundle.jswhich will be transferred on device. So your plugin's code will be available runtime.