Basic app not working : renderType "render" did not return a function.
Describe the bug or question
To Reproduce
Follow the getting started section of the documentation : https://single-spa.js.org/docs/getting-started-overview/
Here is what I Did :
Root module
create-single-spa --moduleType root-config
? Directory for new project src
? Which package manager do you want to use? yarn
? Will this project use Typescript? Yes
? Would you like to use single-spa Layout Engine No
? Organization name (can use letters, numbers, dash or underscore) Org
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /data/src/.git/
Initialized empty Git repository in /data/src/.git/
Initialized git repository
create src/package.json
create src/babel.config.json
create src/.gitignore
create src/.husky/pre-commit
create src/.eslintrc
create src/.prettierignore
create src/webpack.config.js
create src/tsconfig.json
create src/src/Org-root-config.ts
create src/src/index.ejs
create src/src/declarations.d.ts
No change to package.json was detected. No package manager install will be executed.
I'm all done. Running yarn install for you to install the required dependencies. If this fails, try running the command yourself.
yarn install v1.22.22
---
---
success Saved lockfile.
$ husky install
husky - Git hooks installed
Done in 16.03s.
Project setup complete!
Run 'yarn start' to boot up your single-spa root config
I can now access my root module at : https://micro-frontend-root.local/
Module Team 1
create-single-spa --moduleType app-parcel
? Directory for new project src
? Which framework do you want to use? react
? Which package manager do you want to use? yarn
? Will this project use Typescript? Yes
? What module format should this microfrontend be bundled to? esm
? Organization name (can use letters, numbers, dash or underscore) Org
? Project name (can use letters, numbers, dash or underscore) application-team1
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /data/src/.git/
Initialized empty Git repository in /data/src/.git/
Initialized git repository
create src/package.json
create src/jest.config.js
create src/babel.config.json
create src/.eslintrc
create src/.gitignore
create src/.husky/pre-commit
create src/src/declarations.d.ts
create src/.prettierignore
create src/webpack.config.js
create src/src/root.component.tsx
create src/src/root.component.test.tsx
create src/src/Org-application-team1.tsx
create src/tsconfig.json
No change to package.json was detected. No package manager install will be executed.
I'm all done. Running yarn install for you to install the required dependencies. If this fails, try running the command yourself.
success Saved lockfile.
$ husky install
husky - Git hooks installed
Done in 33.42s.
Project setup complete!
Steps to test your React single-spa application:
1. Run 'yarn start --port 8500'
2. Go to http://single-spa-playground.org/playground/instant-test?name=@Org/application-team1&url=8500 to see it working!Now my app is accesible here : https://micro-frontend-team1.local/
So I have this accessible : https://micro-frontend-team1.local/Org-application-team1.js
Now when I Modify my root application :
<!-- Shared dependencies go into this import map -->
<script type="injector-importmap">
{
"imports": {
"single-spa": "https://cdn.jsdelivr.net/npm/[email protected]/lib/es2015/esm/single-spa.min.js"
"react": "https://cdn.jsdelivr.net/npm/[email protected]/+esm",
"react-dom": "https://cdn.jsdelivr.net/npm/[email protected]/+esm"
}
}
</script>And
registerApplication({
name: "@Org/application-team1",
app: () =>
import(
/* webpackIgnore: true */ // @ts-ignore-next
"https://micro-frontend-team1.local/Org-application-team1.js",
),
activeWhen: ["/"],
});Uncaught runtime errors: × ERROR application '@Org/application-team1' died in status SKIP_BECAUSE_BROKEN: renderType "render" did not return a function. Error: renderType "render" did not return a function. at u.elementToRender (https://micro-frontend-team1.local/Org-application-team1.js:3436:4977) at https://micro-frontend-team1.local/Org-application-team1.js:3436:5262 at new Promise () at p (https://micro-frontend-team1.local/Org-application-team1.js:3436:4017) at https://cdn.jsdelivr.net/npm/[email protected]/lib/es2015/esm/single-spa.dev.js:237:29
Any idea on how to solve this and Am I the only one getting this ?
Did I miss something in the getting started section ?
Thanks !
Source: single-spa/single-spa