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.

Injected not showing up

See original GitHub issue

Hopefully I’m missing something simple, but the injected data isn’t showing up after build…

Here’s my config:

plugins: [
  new PrerenderSPAPlugin({
    staticDir: path.join(__dirname, 'dist'),
    routes,
    renderer: new Renderer({
      injectProperty: '__PRERENDER_INJECTED',
      inject: {
        foo: 'bar'
      },
      headless: false,
      renderAfterDocumentEvent: 'render-event',
      maxConcurrentRoutes: 5
    })
  })
]

And it builds successfully

image

Yet, window['__PRERENDER_INJECTED'] is undefined

image

Any help/thoughts would be much appreciated! Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
pzanitticommented, Apr 5, 2018

Which browser window are you using the console in, when the Chromium puppeteer runs or when opening the generated file?

It works fine in the Chromium puppeteer, but the injected attribute will not be available in the prerendered file.

1reaction
JoshTheDerfcommented, Apr 5, 2018

Perhaps something like this would work? (Written on a phone, no promises.)


If (window['__PRERENDER_INJECTED']) {
  const script = document.createElement('script')
  script.appendChild(document.createTextNode(`
    window['__STORED_INJECTED'] =
${JSON.stringify(window['__PRERENDER_INJECTED'])}
  `))
   document.head.appendChild(script)
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Help] DLGMemor injected isn't showing up in settings for me ...
[Help] DLGMemor injected isn't showing up in settings for me on iOS 12.1.2 please help ... Its not showing up for me either....
Read more >
[Help/Support] DLGMemor Injected Not Showing Up in Game ...
I got DLG showing up in my settings on my IPhone but its not showing up in my activated games with the little...
Read more >
provided/injected data doesn't show up in devtools · Issue #1346
When providing or injecting data in a component's setup function. The data/const doesn't show up in the devtools.
Read more >
Stripe card-element not showing on injected script of chrome ...
I would like to inject a Modal popup from content.js in chrome extension that allows the user to pay from the Modal.
Read more >
D3D MENU not showing up when injected. - Guided Hacking
I fixed it by using another injector and auto injecting it on start up. So even though it works now i know its...
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