Skip to content
Snippets Groups Projects
Commit 607b0bed authored by Alejandro De Maria Antolinos's avatar Alejandro De Maria Antolinos
Browse files

Added module federation

parent 98584d8f
Branches 15-runtime-integration-with-module-federation-3
No related tags found
4 merge requests!27Resolve "Rely on booswatch styles",!26Draft: Resolve "Do investigation list table",!25Update 61 files,!19Draft: Resolve "Runtime Integration with module federation"
Pipeline #114118 failed
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.0", "@babel/core": "^7.21.0",
"@babel/preset-env": "^7.21.4", "@babel/preset-env": "^7.21.4",
"@originjs/vite-plugin-federation": "^1.2.2",
"@types/lodash": "^4.14.191", "@types/lodash": "^4.14.191",
"@types/react": "^18.0.28", "@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
......
...@@ -6,6 +6,7 @@ import { ...@@ -6,6 +6,7 @@ import {
} from '@edata-portal/core'; } from '@edata-portal/core';
import { Suspense } from 'react'; import { Suspense } from 'react';
import { Alert } from 'react-bootstrap'; import { Alert } from 'react-bootstrap';
import { SessionViewer } from 'remoteApp/SessionViewer';
export function Investigation() { export function Investigation() {
const investigationId = usePath('investigationId'); const investigationId = usePath('investigationId');
...@@ -17,6 +18,7 @@ export function Investigation() { ...@@ -17,6 +18,7 @@ export function Investigation() {
</Suspense> </Suspense>
<> <>
Session Viewer Beamline and date (renderDataset) Session Viewer Beamline and date (renderDataset)
<SessionViewer></SessionViewer>
<br /> <br />
<>Foreach Data viewer</> <>Foreach Data viewer</>
</> </>
......
...@@ -2,13 +2,20 @@ import { defineConfig } from 'vite'; ...@@ -2,13 +2,20 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths'; import tsconfigPaths from 'vite-tsconfig-paths';
import legacy from '@vitejs/plugin-legacy'; import legacy from '@vitejs/plugin-legacy';
import federation from '@originjs/vite-plugin-federation';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
react(), react(),
tsconfigPaths(), tsconfigPaths(),
legacy({ targets: ['defaults', 'not IE 11', 'Chrome>= 70'] }), legacy({ targets: ['defaults', 'not IE 11', 'Chrome>= 70'] }),
federation({
name: 'app',
remotes: {
remoteApp: 'http://localhost:3001/assets/remoteEntry.js',
},
shared: ['react', 'react-dom'],
}),
], ],
server: { server: {
port: 3000, port: 3000,
......
...@@ -4,25 +4,69 @@ ...@@ -4,25 +4,69 @@
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --port 3001 --strictPort",
"build": "tsc && vite build", "build": "vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview" "preview": "vite preview --port 3001 --strictPort"
}, },
"dependencies": { "dependencies": {
"@babel/eslint-parser": "^7.19.1",
"@edata-portal/core": "workspace:*",
"@fortawesome/fontawesome-svg-core": "^6.3.0",
"@fortawesome/free-solid-svg-icons": "^6.3.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"lodash": "^4.17.21",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-bootstrap": "^2.7.2",
"react-dom": "^18.2.0",
"react-intersection-observer": "^9.4.3",
"react-router-dom": "^6.8.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.21.4",
"@originjs/vite-plugin-federation": "^1.2.2",
"@types/lodash": "^4.14.191",
"@types/react": "^18.0.28", "@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.57.1", "@vitejs/plugin-legacy": "^4.0.2",
"@typescript-eslint/parser": "^5.57.1", "@vitejs/plugin-react": "^3.1.0",
"@vitejs/plugin-react": "^4.0.0", "eslint": "^8.36.0",
"eslint": "^8.38.0", "prettier": "^2.8.6",
"eslint-plugin-react-hooks": "^4.6.0", "terser": "^5.16.5",
"eslint-plugin-react-refresh": "^0.3.4", "typescript": "^4.9.3",
"typescript": "^5.0.2", "vite": "^4.2.0",
"vite": "^4.3.2" "vite-tsconfig-paths": "^4.0.7"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest",
"plugin:react/recommended",
"plugin:react/jsx-runtime"
],
"rules": {
"react/no-unknown-property": "off",
"no-restricted-imports": [
"error",
{
"patterns": [
".*"
]
}
]
},
"overrides": [
{
"files": [
"index.ts",
"index.tsx"
],
"rules": {
"no-restricted-imports": "off"
}
}
],
"root": true
} }
} }
{ {
"extends": "../../tsconfig.json",
"include": ["src"],
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "baseUrl": "src",
"lib": ["DOM", "DOM.Iterable", "ESNext"], "outDir": "dist",
"module": "ESNext", "noEmit": true
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
}, },
"include": ["src"], "exclude": ["../../packages/*"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [
{ "path": "./tsconfig.node.json" },
{ "path": "../../packages/core" }
]
} }
import { defineConfig } from 'vite' import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react';
import federation from '@originjs/vite-plugin-federation';
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [
}) react(),
federation({
name: 'remote_app',
filename: 'remoteEntry.js',
exposes: {
'./SessionViewer': './src/components/SessionViewer',
},
shared: ['react', 'react-dom'],
}),
],
build: {
modulePreload: false,
target: 'esnext',
minify: false,
cssCodeSplit: false,
},
});
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment