Closed pedrocandidozup closed 3 weeks ago
`{ "name": "host", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite --port 4173", "build": "tsc && vite build", "preview": "npm run build && vite preview --port 4173" }, "dependencies": { "rxjs": "^7.8.1"
},
"devDependencies": {
"@module-federation/vite": "^0.2.8",
"@softarc/native-federation-esbuild": "^2.0.4",
"@softarc/native-federation": "^2.0.4",
"@types/react-dom": "^18.2.14",
"@types/react": "^18.2.33",
"@vitejs/plugin-react": "^4.1.0",
"autoprefixer": "^10.4.16",
"esbuild": "^0.19.5",
"postcss-load-config": "^4.0.1",
"postcss": "^8.4.31",
"react-dom": "^18.2.0",
"react": "^18.2.0",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2",
"vite": "^4.5.0"
}
}`
In your repository @gioboa, when I put "react" in dependecies in the same error is shown The entry point "react" cannot be marked as external and when I put the whatever other depeds in "dependencies" is show the same error
Is the same for the Example Module Federation the project doesn't work because "react" is stay in dependencies when I put in the devDependencies the error is gone, but in my project here for the project is running I need to put all my deps in devDependencies
Hi! For solving The entry point "react" cannot be marked as external
see my answer in this issue https://github.com/module-federation/vite/issues/16#issuecomment-2072213372
For suppress pre-transform error, try to set server.preTransformRequests
to false
in vite config. Looks like we don't need deps pre-transformation because it's work of adapter.
@sedx yes, after that, I tried to removed "react" at vite.config, but I think it not the best solutions..
I will try use "server.preTransformRequests"
We are working on a new version that will definitely solves this. @ScriptedAlchemy did a big step forward, he did the official esbuild adapter and the runtime loaders too.
I look for the projects @gioboa is providing in the github, but all the projects you put all dependecies in "devDependecies" for the project work, e.g:
https://github.com/gioboa/react-microfrontends-spotify/blob/main/host/package.json
Is the same for me in the projects, when I putting some deps in "dependencies" is shown the error
and If I stay "react" in "dependecies" the error is shown The entry point "react" cannot be marked as externa