klippa-app/nativescript-http

[Question] Webpack 5 Error

pradumnk-mahanta opened this issue · 8 comments

Which platform(s) does your issue occur on?

  • Both

Please, provide the following version numbers that your issue occurs with:

  • CLI: 8.0.1
  • Cross-platform modules: 8.0.0
  • Runtime(s): 8.0.0

I am trying to use this in a NS8 Project and am getting the following error on the logs when trying to run the application

ERROR in NormalModuleFactory.beforeResolve (NativeScriptHTTPPlugin, angular-compiler) is no longer a waterfall hook, but a bailing hook instead. Do not return the passed object, but modify it instead. Returning false will ignore the request and results in no module created.

I am implementing the plugin in the web pack using the documentation,

webpack.chainWebpack(config => {
    config.plugin('NativeScriptHTTPPlugin').use(NativeScriptHTTPPlugin);
});

Does this not support NS8 Webpack yet? I will try to implement this by importing the HTTP Module for now.

Hi @pradumnk-mahanta. Webpack 5 has a minor changes.

"Changed hooks in NormalModuleFactory from waterfall to bailing, changed and renamed hooks that return waterfall functions"

It seems it maybe be change on NativeScriptHTTPPlugin source code.

I'm looking into a NS8 version soon.

I have just released version 3.0.0 to support NS8 and also updated the readme.

@jerbob92 Thank you for your prompt support. I wasn't expecting NS 8 Version for another month or so.

I implemented this as per the docs, however I am getting the following error on API Calls, which work fine without the plugin enabled in the Webpack.

Error while parsing debug `response` object. Error: BINDINGS: string value expected
CONSOLE ERROR: ERROR TypeError: Cannot read property 'originalStack' of null
Error while parsing debug `response` object. Error: BINDINGS: string value expected
Error while parsing debug `response` object. Error: BINDINGS: string value expected
CONSOLE ERROR: ERROR TypeError: Cannot read property 'originalStack' of null

I am assuming it is still in progress, so I will wait a bit more. Do let me know if you need any other details form my end.

@jerbob92 Thank you for your prompt support. I wasn't expecting NS 8 Version for another month or so.

I implemented this as per the docs, however I am getting the following error on API Calls, which work fine without the plugin enabled in the Webpack.

Error while parsing debug `response` object. Error: BINDINGS: string value expected
CONSOLE ERROR: ERROR TypeError: Cannot read property 'originalStack' of null
Error while parsing debug `response` object. Error: BINDINGS: string value expected
Error while parsing debug `response` object. Error: BINDINGS: string value expected
CONSOLE ERROR: ERROR TypeError: Cannot read property 'originalStack' of null

I am assuming it is still in progress, so I will wait a bit more. Do let me know if you need any other details form my end.

I tested it yesterday in NS8, and it worked fine. However, there is indeed some work to do, in the demo's and the Angular implementation. I will look into that today.

Can you tell me how you are doing the requests? So I can try to reproduce?

Hi @jerbob92, I am using Angular Calls.

GetCompanies(entityMapping): any {
    return this.http.post(AppData.URL_API + AppData.URL_API_SUB + "getCompanies", entityMapping, { observe: 'response' });
}

then I subscribe to this function from wherever I need to make the call.

this.verificationService.GetCompanies({ "BusinessEntity": AppData.BUSINESS_ENTITY })
    .subscribe((response) => {

    });

UPDATE: It works on webpack@5.0.0-beta.14. I was on webpack@5.0.0-beta.9 fixed and it did not work and provided the ERROR as I shared. I updated my Webpack version to "@nativescript/webpack": "beta" and it fetched the latest version of the Webpack and everything seems to be working now.

So maybe it was a Webpack issue. I'll test on this more and confirm everything for you.

Thanks for testing :)
Everything else in the project is still NS7, so also the Angular module, so it might be possible some things are broken. I'll update verything to NS8/Angular 12 today. It does sound odd to me that NS8 uses a beta version of @nativescript/webpack, but that's also what the templates do.

I have updated the full repo to work with NS8 and have released version 3.0.1.