Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils - 'os' dependency started to be required #827

Closed
tadayosi opened this issue Apr 28, 2023 · 6 comments
Closed

utils - 'os' dependency started to be required #827

tadayosi opened this issue Apr 28, 2023 · 6 comments

Comments

@tadayosi
Copy link

After upgrading @module-federation/utilities from 1.6.0 to 1.7.0, I started to see the following error while building my CRA / CRACO app. Is this an expected change? i.e. starting from 1.7.0, is either installing 'os-browserify' or suppressing 'os' required?

[app]: Process started
[app]: Creating an optimized production build...
[app]: Failed to compile.
[app]: 
[app]: Module not found: Error: Can't resolve 'os' in '/home/runner/work/hawtio-next/hawtio-next/node_modules/@module-federation/utilities/src/utils'
[app]: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
[app]: This is no longer the case. Verify if you need this module and configure a polyfill for it.
[app]: 
[app]: If you want to include a polyfill, you need to:
[app]: 	- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
[app]: 	- install 'os-browserify'
[app]: If you don't want to include a polyfill, you can use an empty module like this:
[app]: 	resolve.fallback: { "os": false }
[app]: 
[app]: 
[app]: Process exited (exit code 1), completed in 30s 754ms
@spnc-omz
Copy link

spnc-omz commented May 2, 2023

Seems related to the addition of correctImportPath.js

https://github.com/module-federation/universe/pull/598/files#diff-4f6f587b9c06f7af513a637c65b67ffe91616577937caa4b89d93047c9468e97

@fyodorovandrei

@fyodorovandrei
Copy link
Contributor

I will investigate this issue, but I can suggest a workaround:

  • Install packages: yarn add os-browserify path-browserify
  • Update config (craco.config.js)
    module.exports = {
      webpack: {
        // ...
        configure: webpackConfig => {
          // ...
          webpackConfig['resolve'] = {
            fallback: {
              path: require.resolve("path-browserify"),
              os: require.resolve("os-browserify")
            },
          }
          // ...
          return webpackConfig
        },
        // ...
      },
    }

@wmain
Copy link

wmain commented May 20, 2023

@fyodorovandrei / @ilteoood This fix hasn't been released, correct?

@fyodorovandrei
Copy link
Contributor

@wmain Yes. @ScriptedAlchemy Do you have any idea when will be published the next version?

@ScriptedAlchemy
Copy link
Member

I'll cut one tomorrow ❤️

@efriandika
Copy link

efriandika commented May 29, 2023

I still have this issue in v1.8.0

ERROR in ../../node_modules/@module-federation/utilities/src/utils/correctImportPath.js 15:13-28

RussellCanfield pushed a commit to RussellCanfield/nextjs-mf that referenced this issue Aug 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants