shared context examples not working
See original GitHub issuei can’t run this example project, error below here.
`lerna info Executing command in 2 packages: “yarn run start” @shared-context/app1: yarn run v1.22.4 @shared-context/app2: yarn run v1.22.4 @shared-context/app1: $ webpack-cli serve @shared-context/app2: $ webpack-cli serve @shared-context/app1: ℹ 「wds」: Project is running at http://localhost:3001/ @shared-context/app1: ℹ 「wds」: webpack output is served from / @shared-context/app1: ℹ 「wds」: Content not from webpack is served from /Users/ots/RepoProject/module-federation-examples-master/shared-context/app1/dist @shared-context/app2: ℹ 「wds」: Project is running at http://localhost:3002/ @shared-context/app2: ℹ 「wds」: webpack output is served from / @shared-context/app2: ℹ 「wds」: Content not from webpack is served from /Users/ots/RepoProject/module-federation-examples-master/shared-context/app2/dist
@shared-context/app1: (node:28924) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. @shared-context/app1: BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
@shared-context/app1: Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. @shared-context/app1: Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*. @shared-context/app1: ✖ 「wdm」: assets by chunk 972 KiB (id hint: vendors) @shared-context/app1: asset vendors-node_modules_react-dom_index_js.js 909 KiB [emitted] (id hint: vendors) @shared-context/app1: asset vendors-node_modules_react_index_js.js 62.8 KiB [emitted] (id hint: vendors) @shared-context/app1: asset main.js 393 KiB [emitted] (name: main) @shared-context/app1: asset node_modules_object-assign_index_js-node_modules_prop-types_checkPropTypes_js.js 8.22 KiB [emitted]
@shared-context/app1: asset src_bootstrap_js.js 4.19 KiB [emitted] @shared-context/app1: asset index.html 108 bytes [emitted] @shared-context/app1: runtime modules 21.8 KiB 15 modules @shared-context/app1: cacheable modules 1.24 MiB @shared-context/app1: modules by path ./node_modules/ 1.24 MiB 33 modules @shared-context/app1: modules by path ./src/*.js 795 bytes 3 modules @shared-context/app1: consume-shared-module modules 168 bytes @shared-context/app1: consume shared module (default) react@^16.13.1 (strict) (fallback: ./node_modules/react/index.js) 42 bytes [built] [code generated]
@shared-context/app1: consume shared module (default) react-dom@^16.13.1 (strict) (fallback: ./node_modules/react-dom/index.js) 42 bytes [built] [code generated] @shared-context/app1: consume shared module (default) @shared-context/shared-library@* (strict) 42 bytes [built] [code generated]
@shared-context/app1: consume shared module (default) react@^16.14.0 (strict) (fallback: ./node_modules/react/index.js) 42 bytes [built] [code generated]
@shared-context/app1: provide-module modules 84 bytes @shared-context/app1: provide shared module (default) react-dom@16.14.0 = ./node_modules/react-dom/index.js 42 bytes [built] [code generated]
@shared-context/app1: provide shared module (default) react@16.14.0 = ./node_modules/react/index.js 42 bytes [built] [code generated]
@shared-context/app1: ./node_modules/webpack/hot/ sync nonrecursive ^./log$ 170 bytes [built] [code generated] @shared-context/app1: remote app2/Welcome 6 bytes (remote) 6 bytes (share-init) [built] [code generated] @shared-context/app1: external “app2@http://localhost:3002/remoteEntry.js” 42 bytes [built] [code generated] @shared-context/app1: WARNING in shared module @shared-context/shared-library @shared-context/app1: No required version specified and unable to automatically determine one. Unable to find required version for “@shared-context/shared-library” in description file (/Users/ots/RepoProject/module-federation-examples-master/shared-context/app1/package.json). It need to be in dependencies, devDependencies or peerDependencies. @shared-context/app1: ERROR in resolving fallback for shared module @shared-context/shared-library @shared-context/app1: Module not found: Error: Can’t resolve ‘@shared-context/shared-library’ in ‘/Users/ots/RepoProject/module-federation-examples-master/shared-context/app1/src’ @shared-context/app1: webpack 5.18.0 compiled with 1 error and 1 warning in 2758 ms @shared-context/app1: ℹ 「wdm」: Failed to compile. @shared-context/app2: (node:28925) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. @shared-context/app2: BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. @shared-context/app2: Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. @shared-context/app2: Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_. @shared-context/app2: ✖ 「wdm」: assets by chunk 1.02 MiB (id hint: vendors) @shared-context/app2: asset vendors-node_modules_react-dom_index_js.js 909 KiB [emitted] (id hint: vendors) @shared-context/app2: asset vendors-shared-library_node_modules_react_index_js.js 70.8 KiB [emitted] (id hint: vendors) @shared-context/app2: asset vendors-node_modules_react_index_js.js 62.8 KiB [emitted] (id hint: vendors) @shared-context/app2: asset main.js 389 KiB [emitted] (name: main) @shared-context/app2: asset remoteEntry.js 27.8 KiB [emitted] (name: app2) @shared-context/app2: asset node_modules_object-assign_index_js-node_modules_prop-types_checkPropTypes_js.js 8.22 KiB [emitted] @shared-context/app2: asset src_bootstrap_js.js 7.08 KiB [emitted] @shared-context/app2: asset src_Welcome_js.js 2.22 KiB [emitted] @shared-context/app2: asset index.html 129 bytes [emitted] @shared-context/app2: runtime modules 38.4 KiB 25 modules @shared-context/app2: cacheable modules 1.31 MiB @shared-context/app2: modules by path ./node_modules/ 1.24 MiB 33 modules @shared-context/app2: modules by path …/shared-library/ 65.6 KiB 7 modules @shared-context/app2: modules by path ./src/.js 945 bytes 4 modules @shared-context/app2: consume-shared-module modules 210 bytes 5 modules @shared-context/app2: provide-module modules 126 bytes @shared-context/app2: provide shared module (default) react-dom@16.14.0 = ./node_modules/react-dom/index.js 42 bytes [built] [code generated] @shared-context/app2: provide shared module (default) react@16.14.0 = ./node_modules/react/index.js 42 bytes [built] [code generated] @shared-context/app2: provide shared module (default) react@16.14.0 = …/shared-library/node_modules/react/index.js 42 bytes [built] [code generated] @shared-context/app2: container entry 42 bytes [built] [code generated] @shared-context/app2: ./node_modules/webpack/hot/ sync nonrecursive ^./log$ 170 bytes [built] [code generated] @shared-context/app2: WARNING in shared module @shared-context/shared-library @shared-context/app2: No required version specified and unable to automatically determine one. Unable to find required version for “@shared-context/shared-library” in description file (/Users/ots/RepoProject/module-federation-examples-master/shared-context/app2/package.json). It need to be in dependencies, devDependencies or peerDependencies. @shared-context/app2: ERROR in resolving fallback for shared module @shared-context/shared-library @shared-context/app2: Module not found: Error: Can’t resolve ‘@shared-context/shared-library’ in ‘/Users/ots/RepoProject/module-federation-examples-master/shared-context/app2/src’ @shared-context/app2: webpack 5.18.0 compiled with 1 error and 1 warning in 3035 ms @shared-context/app2: ℹ 「wdm」: Failed to compile.`
any one can help me please?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:20 (6 by maintainers)
Top GitHub Comments
same problem. I think share ‘@shared-context/shared-library’ like the demo is impossible, webpack cannot resolve the library without any other config file but just a string. maybe the demo means after publish ‘@shared-context/shared-library’ to registry, and share it like a normal library.
We call it rexpoets. Basically you create a file that import exports whatever you manually shake.
No automatic solution though