Issue with webpack and plugins




I’am facing an issue on android with webpack and some modules:
common problem it that the module cannot access a variable com.xxxx.

the issue on onesignal plugin: (seams working some times: NS Angular + Webpack + Onesignal plugin)
the issue on couchbase plugin:
the issue on color-picker plugin:

I cannot understand why the com variable have all extension available without webpack but is almost empty with webpack. For exemple com.couchbase is available everywhere without webpack and undefined with webpack.

Do anyone have an idea ?

Thanks !

NS Angular + Webpack + Onesignal plugin

I’m not sure I understand.

For OneSignal, this is what I use in main.module.ts:

let TnsOneSignal = require(“nativescript-onesignal”).TnsOneSignal;

if ( {
application.on(application.launchEvent, function (args: application.ApplicationEventData) {
try {
} catch (error) {
console.error(“error”, error);
if (application.ios) {
class MyDelegate extends UIResponder implements UIApplicationDelegate {

    public static ObjCProtocols = [UIApplicationDelegate];

    applicationDidFinishLaunchingWithOptions(app: UIApplication, launchOptions: NSDictionary<any, any>): boolean {

        try {
            TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, Config.oneSignalProyectId);

        } catch (error) {
            console.error('error', error);

        return true;

application.ios.delegate = MyDelegate;


It compiles with webpack, but I had to modify the nativescript-onesignal plugin’s package.json file (this is in node_modules/nativescript-onesignal), changing “main”: “onesignal.js” to “main”: “onesignal”

This was a while ago, maybe four months or so. Plugins may be updated now (nativescript-onesignal is), so maybe there’s another conflict.

This is what I was using back then:

“dependencies”: {
"@angular/animations": “~4.1.0”,
"@angular/common": “~4.1.0”,
"@angular/compiler": “~4.1.0”,
"@angular/core": “~4.1.0”,
"@angular/forms": “~4.1.0”,
"@angular/http": “~4.1.0”,
"@angular/platform-browser": “~4.1.0”,
"@angular/router": “~4.1.0”,
“nativescript-angular”: “~3.0.0”,
“nativescript-onesignal”: “^1.0.6”,
“nativescript-telerik-ui”: “^2.0.1”,
“nativescript-theme-core”: “~1.0.2”,
“reflect-metadata”: “~0.1.8”,
“rxjs”: “~5.3.0”,
“tns-core-modules”: “^3.0.1”,
“zone.js”: “~0.8.2”
“devDependencies”: {
"@angular/compiler-cli": “~4.1.0”,
"@ngtools/webpack": “1.3.1”,
“babel-traverse”: “6.24.1”,
“babel-types”: “6.24.1”,
“babylon”: “6.17.1”,
“copy-webpack-plugin”: “~4.0.1”,
“extract-text-webpack-plugin”: “~2.1.0”,
“lazy”: “1.0.11”,
“nativescript-css-loader”: “~0.26.0”,
“nativescript-custom-entitlements”: “^0.2.0”,
“nativescript-dev-sass”: “^1.1.1”,
“nativescript-dev-typescript”: “~0.4.0”,
“nativescript-dev-webpack”: “^0.6.0”,
“raw-loader”: “~0.5.1”,
“resolve-url-loader”: “~2.0.2”,
“tns-platform-declarations”: “^3.0.0-rc.2”,
“typescript”: “~2.2.1”,
“webpack”: “~2.5.1”,
“webpack-sources”: “~0.2.3”

You should try removing all of these plugins you mentioned, and try to compile separatedly, ie: enable onesignal and compile using Webpack; if everything is OK, enable couchbase and compile, etc.


Hello !

thanks for your answser.
I think I just find the solution: it’s related to an old nativescript version: I had not update my NS version fora while, and updating it fix the prolem…