Help making a plugin webpack-compatible


Hey all,

I’m trying to make this plugin webpack-compatible,, and I’m hitting some issues.

The plugin works fine without webpack, but with webpack enabled I hit this issue.

file:///app/vendor.js:10954:56: JS ERROR Error: Building UI from XML. @file:///app/main-page.xml:11

And that’s about all I have. I’m not sure what’s up here. Are there any obvious tips to make plugins webpack compatible that I’m missing? I removed the .js file from the "main" of this plugin,, but that doesn’t seem to have been enough.

Note to test this all you have to do is…

  1. Create a project. tns create foo and cd foo.
  2. Install the plugin. npm install nativescript-statusbar --save
  3. Install webpack. npm install --save-dev nativescript-dev-webpack and npm install.
  4. Run the app. Note that with tns run ios the plugin works fine, but that with tns run ios --bundle the problem occurs.

Any help would be really appreciated. Thanks!


Panayot helped me figure this one out :smile:

The problem is apps that use the plugin must register the plugin’s module in their app/bundle-config.js file. I added a note to the status bar plugin’s README: