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

requireEntrypoint broken on Webpack 5 #794

Closed
reverofevil opened this issue Jun 19, 2021 · 6 comments
Closed

requireEntrypoint broken on Webpack 5 #794

reverofevil opened this issue Jun 19, 2021 · 6 comments
Assignees
Labels

Comments

@reverofevil
Copy link

reverofevil commented Jun 19, 2021

🐛 Bug Report

compilation.getStats() doesn't return whatever it returned previously. Now corresponding object in loadable-stats file looks like this:

  "assets": [
    {
      "type": "assets by status",
      "cached": true,
      "filteredChildren": 4,
      "size": 98968
    }
  ],

Monkey-patching assets prior to new ChunkExtractor in this way helps:

const stats = JSON.parse(await readFile(statsFile, 'utf-8'));
stats.assets = Object.values(stats.namedChunkGroups);
const nodeExtractor = new ChunkExtractor({ stats });
const foo = nodeExtractor.requireEntrypoint();

To Reproduce

  1. requireEntrypoint
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:363:5)
    at validateString (node:internal/validators:119:11)
    at Object.extname (node:path:837:5)
    at getFileScriptType (PROJECT\node_modules\@loadable\server\lib\ChunkExtractor.js:49:60)
    at isScriptFile (PROJECT\node_modules\@loadable\server\lib\ChunkExtractor.js:53:10)
    at PROJECT\node_modules\@loadable\server\lib\ChunkExtractor.js:367:11
    at Array.filter (<anonymous>)
    at ChunkExtractor.requireEntrypoint (PROJECT\node_modules\@loadable\server\lib\ChunkExtractor.js:365:23)

Expected behavior

No error.

Link to repl or repo (highly encouraged)

Hopefully I've given enough information to reproduce. Otherwise let it stall.

Run npx envinfo --system --binaries --npmPackages @loadable/component,@loadable/server,@loadable/webpack-plugin,@loadable/babel-plugin --markdown --clipboard

Paste the results here:

## System:
 - OS: Windows 10
## Binaries:
 - Node: 16.2.0
 - npm: 7.13.0
## npmPackages:
 - @loadable/babel-plugin: 5.13.2 => 5.13.2
 - @loadable/component: 5.15.0 => 5.15.0
 - @loadable/server: 5.15.0 => 5.15.0
 - @loadable/webpack-plugin: 5.15.0 => 5.15.0
@open-collective-bot
Copy link

Hey @polkovnikov-ph 👋,
Thank you for opening an issue. We'll get back to you as soon as we can.
Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.
If you use Loadable at work, you can also ask your company to sponsor us ❤️.

@theKashey theKashey self-assigned this Jun 20, 2021
@theKashey
Copy link
Collaborator

Related: #791, #770

@apizzini
Copy link

I'm experiencing the same issue and #779 fixes it (thanks @depoulo).

@theKashey any chance we can get a release cut with this fix in please?

@loks0n
Copy link

loks0n commented Aug 3, 2021

#779 works great.
Does anyone have an intermediate solution whilst we wait for the release?

@depoulo
Copy link
Contributor

depoulo commented Aug 3, 2021

#779 works great.
Does anyone have an intermediate solution whilst we wait for the release?

Quoting #770 (comment):

I also published an according git tag to be used with npm / yarn: depoulo/loadable-components#@loadable/webpack-plugin/cached-assets-770/5.15.1.

@stale
Copy link

stale bot commented Oct 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 12, 2021
@stale stale bot closed this as completed Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants