Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Added recommended solution for Webpack publicPath handling for isomorphic apps #310

Merged
merged 1 commit into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ And don't miss the **[Step-By-Step lessons about apps development with ILC](./do
* [Global API](https://namecheap.github.io/ilc-sdk/pages/Pages/global_api.html)
* [ILC transition hooks](./docs/transition_hooks.md)
* [Multi-domains](./docs/multi-domains.md)
* [Public Path Problem](https://namecheap.github.io/ilc-sdk/pages/Pages/public_path.html)

## 🔌 Adapters
To conveniently connect various frameworks to ILC we rely on the [ecosystem of the single-spa](https://single-spa.js.org/docs/ecosystem)
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ services:
demo-apps:
image: namecheap/ilc-demo-apps:latest
network_mode: "service:ilc" # We need this to make apps accessible at 127.0.0.1 inside "ilc" container
env_file:
- ./demo-apps.env # Used by the demo site to override PUBLIC_HOST var
mysql:
image: mysql:5.7
volumes:
Expand Down
10 changes: 2 additions & 8 deletions docs/umd_bundles_compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This will remove `window.define` variable so all your libs should instead use `w
When using webpack - here is how you can force usage of `window.ILC.define` while building the apps for ILC:

```javascript
const WrapperPlugin = require('wrapper-webpack-plugin');
const ilcWebpackPluginsFactory = require('ilc-sdk').WebpackPluginsFactory;

module.exports = {
entry: 'src/app.js',
Expand All @@ -24,13 +24,7 @@ module.exports = {
libraryTarget: 'amd',
},
module: { /* ... */ },
plugins: [
new WrapperPlugin({
test: /\.js$/, // only wrap output of bundle files with '.js' extension
header: '(function(define){\n',
footer: '\n})((window.ILC && window.ILC.define) || window.define);'
}),
],
plugins: ilcWebpackPluginsFactory().client,
};


Expand Down
12 changes: 3 additions & 9 deletions registry/server/seeds/01_apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export async function seed(knex: Knex): Promise<any> {
src: 'http://localhost:8235/',
timeout: 1000,
}),
props: JSON.stringify({
publicPath: `http://${publicHost}:8235/`
}),
props: '{}',
kind: 'essential',
}, {
name: '@portal/people',
Expand All @@ -28,9 +26,7 @@ export async function seed(knex: Knex): Promise<any> {
rxjs: 'https://unpkg.com/rxjs@6.4.0/bundles/rxjs.umd.js',
'@portal/fetchWithCache': `http://${publicHost}:8238/fetchWithCache.js`,
}),
props: JSON.stringify({
publicPath: `http://${publicHost}:8236/`
}),
props: '{}',
kind: 'primary',
}, {
name: '@portal/planets',
Expand All @@ -50,9 +46,7 @@ export async function seed(knex: Knex): Promise<any> {
}),
assetsDiscoveryUrl: 'http://127.0.0.1:8239/_spa/dev/assets-discovery',
dependencies: '{}',
props: JSON.stringify({
publicPath: `http://${publicHost}:8239/dist/`
}),
props: '{}',
kind: 'primary',
}, {
name: '@portal/system',
Expand Down