stealjs / steal

Gets JavaScript
https://stealjs.com
MIT License
1.36k stars 522 forks source link

Not possible to have two steal bundled apps on the same page #1520

Open ivospinheiro opened 4 years ago

ivospinheiro commented 4 years ago

How often can you reproduce it?

Description:

When we add two different applications with steal bundled and they are deployed on different pathname or different domains, the applications does not work as expected. The second loaded applications tries to load for a stealConfig.js file and when the application loads static content it tries to load the content from the main HTML file baseURL.

Steps to reproduce:

  1. Checkout the code from steal-multi-app.git
  2. Follow the instructions on README.md file

Expected results:

The app should work without any failing resource request.

Actual results: The second application tries to load stealConfig.js file. Both applications fails to load when trying to load the static content assets like CSS files.

Environment:

Software Version
Steal version 2.2.4
Steal-tools version 2.2.6
node -v v12.13.0
npm -v 6.12.0
Browser Chrome
Operating system Linux
matthewp commented 4 years ago

Steal is a very global library. Is it not possible to use a shared config and use the mult-app build ?

ivospinheiro commented 4 years ago

@matthewp using a shared config and use a multi-app build the apps need to be build at the same time, right? Something like:

stealTools.build({
  main: ["app1/src/index", "app2/src/index"]
});

In this case the apps source code are available on the same repo and below the same root folder, but what I'm trying to have is the apps be available from different domains/path names, developed by different teams and source code hosted on different repos, something similar to micro-frontends.

Something similar to what single-spa does, but in my case using web components, to join the different apps into a same html.