ranyelhousieny / react-microfrontends

56 stars 20 forks source link

maybe there're something that need to be improved #1

Open ishowman opened 3 years ago

ishowman commented 3 years ago

need to install babel-loader

When I follow the https://levelup.gitconnected.com/micro-frontends-step-by-step-using-react-webpack-5-and-module-federation-e4b9d840ec71, and type yarn webpack serve. The terminal tells me need to install babel-loader.

webpack version not compatible with create-react-app

need to add .env file at root path:

SKIP_PREFLIGHT_CHECK=true
ranyelhousieny commented 3 years ago

Yes, because you did not delete React from index.js and App.js. You may follow the explanation at step 5.5 at https://www.linkedin.com/pulse/understanding-micro-frontends-webpack5-configurations-rany/

lukaskoeller commented 3 years ago

What is the reason behind using CRA anyway @ranyelhousieny ? You don't run react-scripts start so you're not actually using CRA?

nishitchittora commented 3 years ago

I think using Webpack 5 with create-react-app will lead to more problem each time new devDependencies is added.

I'm getting errors each time new dependency is added.

Starting the development server...

/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

TypeError: Cannot read property 'tap' of undefined
    at /Users/nishit/work/react-microfrontends/mfe1/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/index.js:236:65
    at SyncHook.eval [as call] (eval at create (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:15:1)
    at SyncHook.lazyCompileHook (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.newCompilation (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:631:26)
    at /Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:667:29
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/tapable/lib/Hook.js:154:20)
    at Compiler.compile (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/webpack/lib/Compiler.js:662:28)
    at /Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/webpack/lib/Watching.js:77:18
    at _next0 (eval at create (/Users/nishit/work/react-microfrontends/mfe1/node_modules/react-scripts/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:34:1)
wdanda commented 2 years ago

@nishitchittora I had the same error when I was trying to run "npm run start", but then I tried "yarn webpack serve" and everything started working...