-
Notifications
You must be signed in to change notification settings - Fork 632
On prerendered pages, Webpack injects async <script> that requires webpackJsonp to be defined #9
Comments
It sounds like you just need to change where (or in what order) scripts are getting injected. If you're using |
@chrisvfritz , your suggestion would address my problem if To clarify: After
|
Thanks for clarifying. Unfortunately, Webpack hard-codes it in that split chunks get appended to the head rather than the body. I think your options are to either:
|
Damn. Thanks for listing those fine options, my friend. Imma pray on this for a bit and decide on monday what I'll do. |
…dd context; bump version to 1.4.0
@drewlustro Assuming you are using the |
bahahaha @nemtsov 💯 that works and is much more elegant. I had checked your (pre-edit) approach, and was stressed because my pages were still broken. The If no other drawbacks are known, it looks like my #10 PR is unnecessary. |
@drewlustro If you don't find any other drawbacks, I'd still be happy to accept a PR documenting this approach. 😃 |
@nemtsov I don't think that will fix the problem. |
is this issue has been fixed? |
Actually, the solution is easy , just go where u added the spa prerender plugin, and add ignoreJSErrors: true: |
I have a vue 1.x application that is using
prerender-spa-plugin
. When generating theindex.html
files for each route on build,webpack
will sometimes inject<script src="/static/js/0.[hash].js" async=""></script>
into the<head></head>
.This is normal and expected, as webpack optimizes for loading additional chunks on-demand.
A problem surfaces when visiting the endpoint, because the browser tries tries to evaluate the script
0.[hash].js
beforemanifest.js
orvendor.js
chunks, and reliably causes an exception:Uncaught ReferenceError: webpackJsonp is not defined.
Is there a flag or option to temporarily prevent
webpack
from injecting on-demand chunks? Or must we get hacky and scrub the<script />
tags from prerendered indexes? I cannot naively set thecaptureAfterTime: 0
, as I rely on other aspects of the page asynchronously rendering.The text was updated successfully, but these errors were encountered: