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.

inDevServer method crashes with webpack 5

See original GitHub issue

The problem

Can not create assets manifest file after update to webpack@5. webpack-assets-manifest throws an error in inDevServer https://github.com/webdeveric/webpack-assets-manifest/blob/master/src/WebpackAssetsManifest.js#L838

Because this.compiler.outputFileSystem is [Object: null prototype]

Technical details

HookWebpackError: Cannot read properties of undefined (reading 'name')
        at makeWebpackError ($HOME/path/webpack.buildconfig.library/node_modules/webpack/lib/HookWebpackError.js:48:9)
        at $HOME/path/webpack.buildconfig.library/node_modules/webpack/lib/Compilation.js:3055:12
        at eval (eval at create ($HOME/path/webpack.buildconfig.library/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    -- inner error --
    TypeError: Cannot read properties of undefined (reading 'name')
        at WebpackAssetsManifest.inDevServer ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:838:97)
        at WebpackAssetsManifest.getOutputPath ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:856:15)
        at WebpackAssetsManifest.emitAssetsManifest ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:418:29)
        at WebpackAssetsManifest.handleProcessAssetsReport ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:633:16)
        at fn ($HOME/path/webpack.buildconfig.library/node_modules/webpack/lib/Compilation.js:534:19)
        at _next4 (eval at create ($HOME/path/webpack.buildconfig.library/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:17)
        at eval (eval at create ($HOME/path/webpack.buildconfig.library/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:41:1)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    caused by plugins in Compilation.hooks.processAssets
    TypeError: Cannot read properties of undefined (reading 'name')
        at WebpackAssetsManifest.inDevServer ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:838:97)
        at WebpackAssetsManifest.getOutputPath ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:856:15)
        at WebpackAssetsManifest.emitAssetsManifest ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:418:29)
        at WebpackAssetsManifest.handleProcessAssetsReport ($HOME/path/webpack.buildconfig.library/node_modules/webpack-assets-manifest/src/WebpackAssetsManifest.js:633:16)
        at fn ($HOME/path/webpack.buildconfig.library/node_modules/webpack/lib/Compilation.js:534:19)
        at _next4 (eval at create ($HOME/path/webpack.buildconfig.library/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:17)
        at eval (eval at create ($HOME/path/webpack.buildconfig.library/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:41:1)
        at processTicksAndRejections (node:internal/process/task_queues:96:5)

Webpack version

webpack@5.65.0

Webpack config

    {
      mode: 'production',
      devtool: 'hidden-source-map',
      resolve: {
        extensions: [
          '.ts',   '.tsx',
          '.js',   '.jsx',
          '.json', '.ts',
          '.tsx',  '.js',
          '.jsx',  '.json'
        ],
        alias: {}
      },
      module: {
        rules: [
          [Object], [Object],
          [Object], [Object],
          [Object], [Object],
          [Object]
        ]
      },
      plugins: [
        BundleAnalyzerPlugin {
          opts: [Object],
          server: null,
          logger: [Logger]
        },
        ScopeAmdModulePlugin { scope: 'deps.amd' },
        WebpackAssetsManifest {
          hooks: [Object],
          options: [Object],
          assets: [Object: null prototype] {},
          assetNames: Map(0) {},
          currentAsset: null,
          compiler: null,
          [Symbol(isMerging)]: false
        }
      ],
      optimization: { minimize: true, minimizer: [ [TerserPlugin] ] },
      entry: [
        'tests/fixtures/react.library.app.tsx',
        'tests/fixtures/index.html'
      ],
      output: {
        filename: 'react.library.app.js',
        path: '$HOME/path/webpack.buildconfig.library/tests/fixtures/dist/react-library/production'
      }
    }

Operating system

MacOs Catalina

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
webdevericcommented, Jan 18, 2022

@blackrabbit99 A new version has been published.

1reaction
webdevericcommented, Jan 13, 2022

I was able to see the null prototype logs when using Jest. I don’t have time to dig into it more but my assumption is that there is some auto mocking going on. I ran the same test case in Mocha and it did not give me the null prototype which just indicates this issue is related to Jest. I’ll try to find some time later today or tomorrow to review you PR again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HMR/Live Reloading broken after Webpack 5 rc.0 -> rc.1 update
EDIT: If it helps, my current fix is to specify "web" as a target when developing and "browserslist" as a target when building...
Read more >
DevServer - webpack
Provides the ability to execute custom middleware after all other middleware internally within the server. webpack.config.js module.exports = { //... devServer: ...
Read more >
webpack 4 config, reloading page crashes - Stack Overflow
Webpack generate main.js file in dist/ folder. You subpage requests it in admin/ folder. Open the HTML file that represents this page and ......
Read more >
webpack crashes node frequently during development - GitLab
I'm currently working around the issue using an approach described in a webpack issue. Basically: $ export NODE_OPTIONS=--max-old-space-size= ...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
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