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

[Bug]: undefined factory 19218 #7031

Closed
mrceperka opened this issue Jul 3, 2024 · 9 comments
Closed

[Bug]: undefined factory 19218 #7031

mrceperka opened this issue Jul 3, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@mrceperka
Copy link

mrceperka commented Jul 3, 2024

System Info

  System:
    OS: Linux 6.5 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 9.16 GB / 23.13 GB
    Container: Yes
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 18.12.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.19.2 - /usr/local/bin/npm
  npmPackages:
    @rspack/cli: ^1.0.0-alpha.0 => 1.0.0-alpha.0 
    @rspack/core: ^1.0.0-alpha.0 => 1.0.0-alpha.0 
    @rspack/plugin-react-refresh: ^1.0.0-alpha.0 => 1.0.0-alpha.0

Details

When running in dev mode (rspack dev) optimization.moduleIds="deterministic" causes errors like undefined factory 19218
I have had hmr and hot mode also enabled.

When changed to moduleIds: isDev ? "named" : "deterministic" it works.

Reproduce link

No response

Reproduce Steps

  1. set optimization.moduleIds="deterministic
  2. rspack dev with hmr
@mrceperka mrceperka added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jul 3, 2024
@JSerFeng JSerFeng self-assigned this Jul 4, 2024
@JSerFeng
Copy link
Collaborator

JSerFeng commented Jul 4, 2024

Can you try to create a minimum repro repo

@mrceperka
Copy link
Author

@JSerFeng I am not at the moment. I've tried with the repro repo but it was working as expected. But I haven't installed all the plugins and dependencies my original repo has.

Is there some command that could help you debug? I think I could run that in private repo and give you output.

@colinaaa
Copy link
Contributor

colinaaa commented Jul 5, 2024

Same issue here. I can provide an internal repro. It works when using Rspack 1.0.0-alpha.0 but does not work when using Rspack 1.0.0-alpha.1.

@JSerFeng
Copy link
Collaborator

JSerFeng commented Jul 8, 2024

try 1.0.0-alpha.2

@mrceperka
Copy link
Author

mrceperka commented Jul 8, 2024

@JSerFeng it won't even start now :(

NODE_ENV=development HMR=1 rspack dev -c webpack/rspack.app.config.js
/var/docker/frontend_v2/node_modules/cliui/build/index.cjs:291
const stringWidth = require('string-width');
                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /var/docker/frontend_v2/node_modules/string-width/index.js from /var/docker/frontend_v2/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /var/docker/frontend_v2/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/cliui/build/index.cjs:291:21)
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/yargs/build/index.cjs:1:60039)
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/yargs/index.cjs:5:30)
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/@rspack/cli/dist/cli.js:35:33)
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/@rspack/cli/dist/bootstrap.js:4:15)
    at Object.<anonymous> (/var/docker/frontend_v2/node_modules/@rspack/cli/bin/rspack:2:16) {
  code: 'ERR_REQUIRE_ESM'

Same problem for alpha.1 as well. Only alpha.0 works for me right now.

@JSerFeng
Copy link
Collaborator

JSerFeng commented Jul 8, 2024

Error [ERR_REQUIRE_ESM]: require() of ES Module

This is not issue with rspack, can you solve it and then continue trying 1.0.0-alpha.2

@mrceperka
Copy link
Author

mrceperka commented Jul 8, 2024

@JSerFeng maybe it's not directly, but why 1.0.0-alpha.0 works and 1.0.0-aplha.2 not? It looks like some rspack dependencies were updated and now the build is broken. When I downgrade to alpha.0 its able to run.

@JSerFeng
Copy link
Collaborator

JSerFeng commented Jul 9, 2024

I think it's because some dependencies are unexpectedly hoist, can you try using pnpm

@mrceperka
Copy link
Author

@JSerFeng thanks for the tip. Will try. I am using yarn v1 and it was working so far (I mean with alpha.0)

@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants