used prerender caused error “”webpackJsonp is not defined”
See original GitHub issueversion:
“prerender-spa-plugin”: “^3.0.0”,
webpack.prod.config.js
plugins:
[
...
new PrerenderSpaPlugin(
{
staticDir: path.join(__dirname, '../dist'),
routes: [ '/']
}
)
...
]
don’t use prerender -> index.html
<!DOCTYPE html>
<html>
<head>
<link href=/static/css/app.01f257429d44337e81b6c9bff847f7b5.css rel=stylesheet>
</head>
<body>
<div id=app></div>
<script type=text/javascript src=/static/js/manifest.2ec36080da6631c95331.js></script>
<script type=text/javascript src=/static/js/vendor.1831ef118bcbb942de67.js></script>
<script type=text/javascript src=/static/js/app.8569207b6ea5243bfd73.js></script>
</body>
</html>
useed prerender -> index.html
<!DOCTYPE html>
<html>
<head>
<link href="/static/css/app.01f257429d44337e81b6c9bff847f7b5.css" rel="stylesheet">
<script type="text/javascript" charset="utf-8" async="" src="/static/js/0.35765bb2a442ad6dab9f.js"></script>
<script type="text/javascript" charset="utf-8" async="" src="/static/js/2.3336565ec6368312e7b1.js"></script>
</head>
<body>
<div id="app">。。。。。。</div>
<script src="/static/js/libs/es6-promise.auto.min.js"></script>
<script type="text/javascript" src="/static/js/manifest.2ec36080da6631c95331.js"></script>
<script type="text/javascript" src="/static/js/vendor.1831ef118bcbb942de67.js"></script>
<script type="text/javascript" src="/static/js/app.8569207b6ea5243bfd73.js"></script>
</body>
</html>
but caused error
the browser‘s console
2.3336565….js:1Uncaught ReferenceError: webpackJsonp is not defined
at 2.3336565….js:1
(anonymous) @ 2.3336565….js:1
0.35765bb….js:1Uncaught ReferenceError: webpackJsonp is not defined
at 0.35765bb….js:1
how to solve this problem.???
and it’s not working
const root = new Vue({ // … })
document.addEventListener(‘DOMContentLoaded’, function () { root.$mount(‘#app’) })
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top Results From Across the Web
webpackJsonp is not defined - Stack Overflow
Problem. I want to load my script however I meet some ReferenceError. Uncaught ReferenceError: webpackJsonp is not defined. I am loading vendor.
Read more >How To Solve ReferenceError window is not defined in ...
Fixing a window is not defined error can be quite simple. In most cases, all you will need to do is wrap your...
Read more >Cannot do server side rendering: ERROR in SERVER ...
ERROR in SERVER PRERENDERING Encountered error: "ReferenceError: webpackJsonp is not defined" Whenever I try to prerender a component in ...
Read more >angular/angular - Gitter
ReferenceError : webpackJsonp is not defined at Object. ... @Gensa23 you can use the prerender approach ... Cause I'm doing the same. MitchZA....
Read more >webpackJsonp not found when running ionic-starter-aws
Runtime Error: webpackJsonP is not defined ... If you put the ref in the wrong place, it can cause the problem too.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reopening this as none of the solutions worked for me.
I get
Uncaught ReferenceError: webpackJsonp is not defined
when I put PrerenderSPAPlugin in the build pipeline. Without PrerenderSPAPlugin, the build works as expected without any issues.I even tried the suggestion as mentioned in https://github.com/chrisvfritz/prerender-spa-plugin/tree/v2#code-splitting.
After implementing the above suggestion, everything stopped working. I got a blank page, without any errors in console. However, network tab shows that all assets get downloaded but the Vue app does not bootstrap for some unknown reason.
I also tried using https://github.com/chrisvfritz/prerender-spa-plugin/tree/v2#code-splitting without any success.
At this point, I dont know how to proceed with this. @kongjiea any idea how to debug or fix it?
FYI, I am using the Vue PWA template - https://github.com/vuejs-templates/pwa
Any updates regarding this problem? I am struggling with the exact same issue…