Comments (9)
This is happening to me with a fresh install when I add <QwikPartytown forward={['dataLayer.push', 'fbq']} />
to the root.tsx
export default component$(() => {
/**
* The root of a QwikCity site always start with the <QwikCityProvider> component,
* immediately followed by the document's <head> and <body>.
*
* Don't remove the `<head>` and `<body>` elements.
*/
return (
<QwikCityProvider>
<head>
<meta charSet="utf-8" />
<link rel="manifest" href="/manifest.json" />
<QwikPartytown forward={['dataLayer.push', 'fbq']} /> <---- If I remove this line, the error goes away
<RouterHead />
</head>
<body lang="en">
<RouterOutlet />
<ServiceWorkerRegister />
</body>
</QwikCityProvider>
);
});
from qwik.
This sounds like some sort of import order issue maybe? Not sure how your additions cause this to break.
It's probably happening here, which uses useQwikCityEnv, which uses useServerData, which is injected into the render function by qwik-city here which generates it from the incoming requests here.
from qwik.
@wmertens, because we want to have dynamic settings, one thing we tried was to return a function that returns the render function in entry.ssr.tsx
. In other words, converting this:
export default function (opts: RenderToStreamOptions) {
return renderToStream(<Root />, {
manifest,
...opts,
// Use container attributes to set attributes on the html tag.
containerAttributes: {
lang: opts.serverData?.locale || "en",
...opts.containerAttributes,
},
});
}
to this:
export default function (props) {
function render(opts: RenderToStreamOptions) {
return renderToStream(<Root {...props} />, {
manifest,
...opts,
containerAttributes: {
lang: opts.serverData?.locale || "en",
...opts.containerAttributes,
},
});
}
return render(props)
}
And changing this line in entry.express.ts
, from this:
const { router, notFound } = createQwikCity({ render, qwikCityPlan, manifest });
to this:
const props = {} // reading settings dynamically in express layer, rather than Qwik layer when the app wants to start
const render = renderer(props)
const { router, notFound } = createQwikCity({ render, qwikCityPlan, manifest });
And that caused this error. But that's a totally valid JavaScript code. What could be wrong here?
from qwik.
Seems ok, you'll have to step through it to figure it the problem.
from qwik.
@wmertens, I have done it a couple of times. But I can't find out the problem. That's why I have submitted an issue. The error is very vague.
from qwik.
Myeah, better to do the dynamic environment like I explained in the other issue.
from qwik.
This happens to me when opening the console in the devtools of Firefox with this additional warning in the console:
Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://356a5cca-d12d-4591-83bc-b31caa7d6363/inject.js
Source Map URL: inject.js.map
from qwik.
I ran into this when using QwikPartytown integration as well. Here's a reproduction: https://stackblitz.com/edit/qwik-starter-7l7lf7?file=src%2Froot.tsx
The above link only runs into an error when you click the reload icon. You'll be able to see the error in terminal.
from qwik.
I faced the same issue, but it was only due to the hostname/domain (localhost) having data of previous app stored in it. It solved itself when I cleared cookies and site data
from qwik.
Related Issues (20)
- [🐞] onPost not working properly
- [🐞] Getting props/restProps inside component$() and turning them into signal doesn't seem to work like expected. HOT 1
- [🐞] Firefox: navigator.serviceWorker is undefined HOT 2
- [✨] Update your template to include eslint.config.js by default HOT 2
- [🐞] plugin:vite:esbuild] [plugin vite:esbuild] src/components/router-head/router-head.tsx: Duplicate key "dangerouslySetInnerHTML" HOT 3
- [🐞] SSG in fresh project not working HOT 2
- [✨] Please upgrade @auth/core version in qwik-auth HOT 26
- There are some tests is weird [🐞] HOT 2
- [✨] use modulepreload if supported
- [✨] Remove the initial lag for `useAuthSignin`
- Modular Forms input loses focus when projected [🐞] HOT 1
- [🐞]
- [🐞] prisma integration HOT 2
- [🐞] Weird behavior when accessing props value in differents way HOT 2
- Probably meant the mdx HOT 1
- [✨] Add the `unwrapProxy` as a Low-Level API HOT 3
- [📖] Hooks Cookbook HOT 2
- [🐞] Custom hook failing when hook function is named starting with use.* HOT 8
- [✨] HTTP 103 Early Hint
- [🐞] service-worker.js pre-populates the cache for some bundles that are not present on the current page HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qwik.