gatsby-plugin-react-helmet-async icon indicating copy to clipboard operation
gatsby-plugin-react-helmet-async copied to clipboard

WebpackError: TypeError: Cannot read property 'add' of undefined

Open magicspon opened this issue 5 years ago • 6 comments

Heyo..

I'm getting an error when running develop or build.

config:

const { plugins } = require('./postcss.config')

module.exports = {
	siteMetadata: {
		title: 'waffles'
	},
	plugins: [
		'gatsby-plugin-react-helmet-async',
		{
			resolve: `gatsby-plugin-nprogress`,
			options: {
				color: `#345DEE`,
				showSpinner: false
			}
		},
		{
			resolve: 'gatsby-plugin-postcss',
			options: {
				postCssPlugins: plugins
			}
		}
	]
}

browser:

export const wrapRootElement = ({ element, props }) => {
	const store = init({
		models,
		plugins: [persistPlugin]
	})
	const persistor = getPersistor()

	return (
		<Provider store={store}>
			<PersistGate loading="loading" persistor={persistor}>
				<NavProvider>
					<ThemeProvider>
						<Layout {...props}>{element}</Layout>
					</ThemeProvider>
				</NavProvider>
			</PersistGate>
		</Provider>
	)
}

ssr

exports.wrapRootElement = ({ element, props }) => {
	const store = init({
		models
	})
	return (
		<Provider store={store}>
			<NavProvider>
				<ThemeProvider>
					<Layout {...props}>{element}</Layout>
				</ThemeProvider>
			</NavProvider>
		</Provider>
	)
}

gatsby info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 13.1.0 - ~/.nvm/versions/node/v13.1.0/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.13.1 - ~/.nvm/versions/node/v13.1.0/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 78.0.3904.108
    Firefox: 70.0.1
    Safari: 13.0.3
  npmPackages:
    gatsby: ^2.18.7 => 2.18.7
    gatsby-plugin-manifest: ^2.2.31 => 2.2.31
    gatsby-plugin-module-local-ident-name: ^0.0.7 => 0.0.7
    gatsby-plugin-nprogress: ^2.1.7 => 2.1.15
    gatsby-plugin-offline: ^3.0.27 => 3.0.27
    gatsby-plugin-postcss: ^2.1.8 => 2.1.16
    gatsby-plugin-react-helmet-async: ^1.0.13 => 1.0.13

image

Any thoughts?

cheers

magicspon avatar Dec 08 '19 17:12 magicspon

Hi @magicspon! Thanks for the bug report. Unfortunately I have had zero time to look at this lately, having just started a new job, and I'm not sure when things will calm down. I've added a "help wanted" label for now.

MartinRosenberg avatar Dec 20 '19 20:12 MartinRosenberg

@magicspon Did you ever resolve this issue? I am running into the same issue on a project I am working on, wondering if you found a fix

paultannenbaum avatar Feb 04 '21 21:02 paultannenbaum

I'm having the same issue and also looking for a fix

pweikel avatar Feb 09 '21 15:02 pweikel

@paultannenbaum sorry, I can't remember... I used gatsby-plugin-react-helmet on my last gatsby site without any issues.

magicspon avatar Feb 09 '21 15:02 magicspon

@pweikel In our project, I first tried removing this repo's plugin and implementing react-helmet-async manually, but when I did this I was only getting helmet to set items in our <head /> during rehydration. I did not spend a ton of time on trying to get SSR to work, but it was a deal breaker for our SEO and so I just reverted back to using react-helmet for our project. I plan on reattempting to implement react-helmet-async when I have more time. Please let us know if you find a solution that you can share.

paultannenbaum avatar Feb 09 '21 18:02 paultannenbaum

Oh my god, I forgot about this issue, I'm sorry everyone. Could someone link me a repo with this problem? I have a much easier time debugging that way.

MartinRosenberg avatar Feb 12 '21 17:02 MartinRosenberg