-
Notifications
You must be signed in to change notification settings - Fork 657
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
TypeError: tag[primaryAttributeKey].toLowerCase is not a function with external scripts in reactjs without gatsby #448
Comments
I have a similar issue and when looking at what is happening there seems to be an issue w/ an array: on a console.log
So the primaryAttributeKey is innerHTML, which exists, but that value is an array. I have the following test setup
I'm able to get this working if I use:
but I have a further problem w/ this that I actually get two rendered script tags, one for when there's no "someState" and one for after there is someState. :/ |
@Way-U-Need What version are you using? |
It's happened with Helmet 5.2.1 and Webpack 4.39.1 in my case. It not happened with Webpack 3.12 |
Also got this issue, using 5.2.1 and the following code, on a Gatsby app: import React from 'react';
import Helmet from 'react-helmet';
import { AppLocale } from '../appTypes';
// prettier-ignore
const FrontLocaleRedirectionScript = ({ locale }: { locale: AppLocale }) => {
return (
<Helmet>
<script type="text/javascript">
alert("page locale = " + {locale});
</script>
</Helmet>
);
};
export default FrontLocaleRedirectionScript; TypeError: tag[primaryAttributeKey].toLowerCase is not a function
|
On my side I'm running into this issue too. Giving a little bit more context
Currently my team is on a major dependency upgrade and we run into this issue when upgrade the |
In case anyone else is still running into this issue...If you use v5 of Due to defaulting to esModule for For more on the general discussion around compatibility you can check out the thread here webpack/webpack#4742 |
@kembly hi there ! Can't make it work. Tried adding as stipulated in gatsby-node.js
but throws me this
Any help would be appreaciated. For me it's the AMP Boilerplate code that is causing this. |
I managed to get round it by not using JSX - this code takes an inlined link or script node, and renders it in the head instead of the body:
|
Just ran into this error while trying to give 2 strings to a {/* inline script elements */}
<script type="application/ld+json">{`
{
"@context": "http://schema.org"
}
`}</script>
{/* noscript elements */}
<noscript>{`
<link rel="stylesheet" type="text/css" href="foo.css" />
`}</noscript>
{/* inline style elements */}
<style type="text/css">{`
body {
background-color: blue;
}
p {
font-size: 12px;
}
`}</style> Note that each of the |
Just ran into this issue with an app bootstrapped with create-react-app 4 with
Will not work, as @kembly pointed, the import points at |
I got the error, trying: <script>{ JSON.stringify(data) }</script> Fix:
|
please help me out from this error:
`TypeError: tag[primaryAttributeKey].toLowerCase is not a function
(anonymous function)
node_modules/react-helmet/lib/HelmetUtils.js:141
138 | return false;
139 | }
140 |
used external javascripts for some animations and css change.
code :
import inspinia from "./assets/js/inspinia" class App extends Component { render() { return ( <> <Helmet> <script src={inspinia} type="text/javascript" /> </Helmet>
The text was updated successfully, but these errors were encountered: