gatsby: [gatsby-plugin-netlify] depracated webpack-assets-manifest causing errors during build

Description

I am upgrading to gatsby v3 and I am using gatsby-plugin-netlify, during build time I get the following errors:

ERROR

(node:17164) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.> getCompilationHooks(compilation).loader (Use node --trace-deprecation ... to show where the warning was created)

ERROR

(node:17164) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. Make sure to select an appropriate stage from Compilation.PROCESSASSETS_STAGE*.

I have drilled down a bit and found that cause of the problem was a deprecated webpack-assets-manifest dependency.

webpack-assets-manifest is compatible with webpack v5 as described here

Steps to reproduce

  • Create a project with gatsby v3
  • Add gatsby-plugin-netlify
  • run npm run build

Environment

System: OS: Windows 10 10.0.19042 CPU: (8) x64 Intel® Core™ i7-8550U CPU @ 1.80GHz Binaries: Node: 14.15.1 - C:\Program Files\nodejs\node.EXE npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.423.0), Chromium (88.0.705.81) npmPackages: gatsby: ^3.0.1 => 3.0.1 gatsby-plugin-google-analytics: ^3.0.0 => 3.0.0 gatsby-plugin-image: ^1.0.0 => 1.0.0 gatsby-plugin-manifest: ^3.0.0 => 3.0.0 gatsby-plugin-mdx: ^2.0.0 => 2.0.0 gatsby-plugin-netlify: ^3.0.0 => 3.0.0 gatsby-plugin-offline: ^4.0.0 => 4.0.0 gatsby-plugin-react-helmet: ^4.0.0 => 4.0.0 gatsby-plugin-robots-txt: ^1.5.5 => 1.5.5 gatsby-plugin-sharp: ^3.0.0 => 3.0.0 gatsby-plugin-sitemap: ^3.0.0 => 3.0.0 gatsby-plugin-styled-components: ^4.0.0 => 4.0.0 gatsby-remark-autolink-headers: ^3.0.0 => 3.0.0 gatsby-remark-copy-linked-files: ^3.0.0 => 3.0.0 gatsby-remark-embedder: ^4.1.0 => 4.1.0 gatsby-remark-images: ^4.0.0 => 4.0.0 gatsby-remark-prismjs: ^4.0.0 => 4.0.0 gatsby-source-filesystem: ^3.0.0 => 3.0.0 gatsby-transformer-sharp: ^3.0.0 => 3.0.0

I would be happy to submit a PR if needed 🚀

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 12
  • Comments: 20 (18 by maintainers)

Commits related to this issue

Most upvoted comments

For folks that want workaround right now - if you use yarn you can add:

"resolutions": {
  "webpack-assets-manifest": "5.0.1"
}

to your package.json to force yarn to install that instead of what plugin has specified right now (unfortunaly there is no reliable equivalent workaround in npm)

I’ve tried the above workaround without success, unfortunately.

I can’t tell from release notes of webpack-assets-manifest is this is just matter of upgrading or there will be any additional changes needed

@pieh - upgrading to webpack-assets-manifest ^4.0.0 seems fine, but upgrading to ^5.0.0 throws error. After running yarn jest gatsby-plugin-netlify, I get a failed test w/ error message: `TypeError: Cannot read property ‘RawSource’ of undefined. (see diff here)

Working on it right now. I’m stumbling an error while running yarn upgrade webpack-plugin-manifest --latest

@talohana - you should just be able to run yarn remove webpack-assets-manifest and yarn add webpack-assets-manifest to update webpack-assets-manifest to the latest v5.0.1. This should update the package.json file under gatsby-plugin-netlify folder and update yarn.lock file in root of gatsby repo.

I’m on the PR review right now, just trying to get to the bottom of failing type check there, but from manual testing it seemed to be working just all right

@pedrolamas - I tested again and the tests are passing. My mistake.

@kimbaudi i see my error. Watching the PR https://github.com/gatsbyjs/gatsby/pull/30217 by @pedrolamas, sound interesting, i will test this last if i can. 😃

@kalwalt - i’m talking about updating gatsby-plugin-netlify dependency on webpack-assets-manifest from current version 3.1.1 (which is causing the error) to a more recent version. unfortunately, i’m really busy right now so I won’t be making any PR for this plugin. I just disable it for now.