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 Report]: Stats module reasons compared to webpack (userRequest and other fields missing) #2593

Closed
lalexdotcom opened this issue Apr 3, 2023 · 1 comment · Fixed by #2671
Labels
feat New feature or request

Comments

@lalexdotcom
Copy link

lalexdotcom commented Apr 3, 2023

System Info

devcontainer

  System:
    OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (5) arm64 unknown
    Memory: 15.93 GB / 23.45 GB
    Container: Yes
    Shell: 5.1.4 - /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: ^0.1.5 => 0.1.5 

Details

Thanks to #2573 workaround, I could have the reason property on modules' compilation stats.
But some fields are missing in RSPack reasons (JsStatsModuleReason) compared to webpack (StatsModuleReason type)
(I'm showing TS types which should be clearer for reporting)

RSPack

export interface JsStatsModuleReason {
  moduleIdentifier?: string
  moduleName?: string
  moduleId?: string
}

Webpack

declare interface KnownStatsModuleReason {
	moduleIdentifier?: string;
	module?: string;
	moduleName?: string;
	resolvedModuleIdentifier?: string;
	resolvedModule?: string;
	type?: string;
	active: boolean;
	explanation?: string;
	userRequest?: string;
	loc?: string;
	moduleId?: string | number;
	resolvedModuleId?: string | number;
}

I'm mainly after the userRequest property, but others may be used...

By the way, the module field is now moduleId, shouldn't it be ISO with webpack for better interoperability? (my bad, moduleId is there 😅)

Reproduce link

https://github.com/lalexdotcom/rspack-bug-report rspack-module-reason-type

Reproduce Steps

!! Be sure to be on rspack-module-reason-type branch !!

  1. run npm install
  2. RSPack output: run npm run rspack-stats-output
Reasons found fields [ 'moduleIdentifier', 'moduleName', 'moduleId' ]
  1. Webpack output: run npm run webpack-stats-output
Reasons found fields [
  'moduleIdentifier',
  'module',
  'moduleName',
  'resolvedModuleIdentifier',
  'resolvedModule',
  'type',
  'active',
  'explanation',
  'userRequest',
  'loc',
  'moduleId',
  'resolvedModuleId'
]
@hyf0 hyf0 added feat New feature or request and removed needs-triage labels Apr 3, 2023
@ScriptedAlchemy
Copy link
Contributor

Nice to have, especially helpful for tools like medusa which do consume alot of info about module reasons

@lalexdotcom lalexdotcom changed the title [Bug Report]: Stats module reasons compared to webpack (module is now moduleId, userRequest and other fields missing) [Bug Report]: Stats module reasons compared to webpack (userRequest and other fields missing) Apr 5, 2023
@ahabhgk ahabhgk linked a pull request Apr 9, 2023 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants