Closed tarunnav closed 5 years ago
Did you get this error as a fork of single-spa-es5-angularjs? If so, the way to export the lifecycle functions is by creating a global variable with those functions in an object. See https://github.com/joeldenning/single-spa-es5-angularjs/blob/master/es5-app.js#L2 for how this is happening in this example repo
I am getting the same error, however I am using single-spa in react framework. Any inputs on how to fix this ? thx
Hi @hiaparna, could you paste some code showing your loading functions? Are you using the recommended setup with System.import()
? Or just webpack import()
?
This error means that your loading function returned a promise that resolved with an object that did not have the single-spa lifecycle functions on it. Loading functions must resolve to an object that has bootstrap
, mount
, and unmount
functions on them.
Hi @joeldenning, I am sharing the demo application build using single-spa. I have added 2 applications and both are in react dashboard and navbar. It works fine in development. However, when we build it and deploy it in nginx, it shows error in console : Uncaught SyntaxError: Unexpected token <. Repo: https://github.com/hiaparna/single_spa_react
I also tried https://github.com/joeldenning/simple-single-spa-webpack-example example in production mode and it gives the same error as : Uncaught SyntaxError: Unexpected token < for common-dependencies and root-application
@hiaparna you need to use AMD targetLibrary in webpack. output: { library: 'blah', libraryTarget: 'amd',
you need to use AMD targetLibrary in webpack. output: { library: 'blah', libraryTarget: 'amd',
Yep, or even better you can use libraryTarget: 'system'
if you're using SystemJS. Also, please follow the instructions in the following links, which should get your webpack config fully up and running:
https://single-spa.js.org/docs/faq.html#code-splits https://single-spa.js.org/docs/faq.html#create-react-app
I have root app which is basic app using singlespa and loading the es5-app.js which is hosted on different port. When I lazy load es5-app.js I get below error
Application 'es5-app' died in status LOADING_SOURCE_CODE: "does not export an unmount function or array of functions"
Could you help me how do export bootstrap, mount and unmount functions from my child app