module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

[Question] URL parameters?

Open dassum03-BH opened this issue 1 year ago • 5 comments

Hello,

Is it possible to fetch the url parameters inside a MFE like this /kpi-widget/remoteEntry.js?type=pie&&kpi=1234

somehow I need to make sure that the app is able to fetch the url parameters pie and kpi values

@ScriptedAlchemy

dassum03-BH avatar Apr 18 '24 13:04 dassum03-BH

use runtime plugins

https://module-federation.io/plugin/dev/index.html

or check the runtime-plugins folder in this repo

ScriptedAlchemy avatar Apr 20 '24 00:04 ScriptedAlchemy

use runtime plugins

https://module-federation.io/plugin/dev/index.html

or check the runtime-plugins folder in this repo

image

Getting this error.. Another question: does this work with old module federation plugin?

This is my webpack.config.js:

const { ModuleFederationPlugin } = require('@module-federation/enhanced'); const path = require('path');

module.exports = { plugins: [ new ModuleFederationPlugin({ name: 'Risk-History', exposes: { './Component': './src/app/risk-history-std/risk-history-std.component.ts', './TableComponent': './src/app/table-widget/table-widget.component.ts', './GaugeComponent': './src/app/health-status/health-status.component.ts', }, runtimePlugins: [require.resolve('./custom-runtime-plugin.js')] }) ], };

@ScriptedAlchemy some help please

dassum03-BH avatar Apr 20 '24 15:04 dassum03-BH

What version of federation/enhanced are you using?

Can you create a repo i can debug - this error should not happen

ScriptedAlchemy avatar Apr 20 '24 22:04 ScriptedAlchemy

What version of federation/enhanced are you using?

Can you create a repo i can debug - this error should not happen

Sharing a repo might not be possible since this is org internal repo.. but here are the dependencies:

"dependencies": { "@angular-architects/module-federation": "^15.0.3", "@angular/animations": "^15.2.0", "@angular/common": "^15.2.0", "@angular/compiler": "^15.2.0", "@angular/core": "^15.2.0", "@angular/elements": "^15.2.9", "@angular/forms": "^15.2.0", "@angular/material": "^15.2.0", "@angular/platform-browser": "^15.2.0", "@angular/platform-browser-dynamic": "^15.2.0", "@angular/router": "^15.2.0", "@bh-ent-tech/bh-utils": "^1.0.4", "@bh-ent-tech/controls-lib-cordant-2.0": "0.0.4", "@bh-ent-tech/plotly-charts": "4.0.8", "@module-federation/enhanced": "^0.1.8", "@module-federation/runtime": "^0.1.8", "express": "^4.18.2", "http-proxy-middleware": "^2.0.6", "ngx-gauge": "^7.1.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.12.0" }, "devDependencies": { "@angular-devkit/build-angular": "^15.2.9", "@rspack/cli": "^0.6.2", "@rspack/core": "^0.6.2", "@rspack/dev-server": "^0.6.2", "@angular/cli": "~15.2.9", "@module-federation/enhanced": "^0.1.8", "@angular/compiler-cli": "^15.2.0", "@types/jasmine": "~4.3.0", "jasmine-core": "~4.5.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.0.0", "webpack-dev-server": "^4.15.1", "webpack": "^5.91.0", "webpack-cli": "^5.1.4", "ngx-build-plus": "^15.0.0", "nodemon": "^3.0.1", "request": "^2.88.2", "typescript": "~4.9.4" }

please let me know in case you need any other file for reference..

dassum03-BH avatar Apr 21 '24 04:04 dassum03-BH

just for sake, I created new angular 17 app and tried with webpack/enhanced.. but same error:

image

const { ModuleFederationPlugin } = require('@module-federation/enhanced');

module.exports = { plugins: [ new ModuleFederationPlugin({ name: 'new-widgets-mfe', filename: 'remoteEntry.js', runtimePlugins: [require.resolve('./control.share.js')], exposes: { './Component': './src/app/app.component.ts', } }) ] };

chelsumz007 avatar Apr 21 '24 05:04 chelsumz007

Without a repo i will not be able to assist further

ScriptedAlchemy avatar Apr 29 '24 01:04 ScriptedAlchemy