Using requires instead of imports prevents from prerendering
See original GitHub issueIt seems using require statements (e.g. const mod = require('module');
instead of imports (e.g. import mod from 'module'
) anywhere in the code prevents any prerendering from occuring.
However, the code still works properly in the browser.
I certainly need to investigate that more and will follow up with a more precise example if there is interest. Meanwhile I’m curious if any of you can confirm / explain this behaviour.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
JavaScript Require vs. Import - Bits and Pieces
With modern web development, we use require or import to refer to JavaScript dependencies. And, sometimes, we use both in combination and ...
Read more >Prerender and integrate ASP.NET Core Razor components
Use the following guidance to integrate Razor components into pages and views of an existing Razor Pages or MVC app. Add an imports...
Read more >Detect require vs. import based on the entry point, not ... - GitHub
any instance of import during the run is now a perfectly normal "import is a reserved keyword" error. any instance of the dynamic...
Read more >Precomposing, nesting, and pre-rendering After Effects ...
Read about precomposing layers and nesting compositions in After Effects, its uses and preferences.
Read more >Using Node.js require vs. ES6 import/export - Stack Overflow
Your answer is totally valid, but I think we're comparing two different characteristics. All import/export is converted to require , granted. But what...
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
I’ve also had that
ReferenceError: Can't find variable: Promise
error, I’ve fixed it (before seeing this issue) by adding core-js’ Promise polyfill in my app.@chrisvfritz are you saying that I shouldn’t do that just to support Phantom?
@drewlustro Manually editing this file like this has fixed the same issue for me on 3 PC’s.
https://github.com/chrisvfritz/prerender-spa-plugin/pull/54/commits/85d7d8cf722d9358c7e9b97def6b72d2e130e61c