question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

requireEntrypoint broken on Webpack 5

See original GitHub issue

🐛 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
apizzinicommented, Jun 21, 2021

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?

1reaction
depoulocommented, Aug 3, 2021

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

Quoting https://github.com/gregberge/loadable-components/issues/770#issuecomment-848551220:

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

requireEntrypoint returns undefined value · Issue #189 - GitHub
Hello, I am running into troubles with SSR + multiple entry points. None of the issues already solved seem to have the same...
Read more >
breaking change since webpack 5: the devtool option is more ...
Webpack has been initialized using a configuration object that does not match the API schema. - configuration.devtool should match pattern "^(inline-|hidden-| ...
Read more >
Getting error "Path" argument must be string while deploying ...
Check by downgrading webpack to 4.31.0, Loadable components has some issues with webpack 5 "webpack": "^4.31.0", "webpack-cli": "^3.3.2", ...
Read more >
Problem: Live reloading isn't refreshing for Webpack 5
As I was setting up my webpack-dev-server for some reason it wasn't actually reloading. Turns out you have to set a target!
Read more >
Entry Points - webpack
We will show you the ways you can configure the entry property, in addition to explaining why it may be useful to you....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found