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.

Is there any hope of this ever working with CDNs? Sometimes it seems the entire webpack ecosystem is built in a world where CDNs aren’t a thing…

If the generated index.html has absolute links for use with a CDN, say, the HTML is served from www.example.com and the assets are served from static.example.com, pre-rendering will fail because the assets are not actually on the CDN yet during the build process. You’d have to pre-render after deploying, so you’d end up with a two-stage deployment. Perhaps a separate build target that uses relative URLs instead of the CDN ones so that everything is available during build?

Is there a solution I’m overlooking?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
drewlustrocommented, Oct 24, 2017

A 2-step deploy is not uncommon.

At some point, we all have to write some code instead of assuming that there will be a plugin (or option for said plugin) to handle every project need.

Why not create a new task like npm run prebuild that creates all of your assets and uploads them to static.example.com as a prerequisite to npm run build?

package.json (hypothetical snippet)

{
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "prebuild": "node build/prebuild.js && rsync -r dist/static/* example.com:/sites/example/static",
    "build": "npm run prebuild && node build/build.js",
  }
}
3reactions
dhgancommented, Apr 18, 2018

@krestaino You can look at this. prerender-cdn-demo

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a CDN? | How do CDNs work? - Cloudflare
A content delivery network (CDN) refers to a geographically distributed group of servers that work together to provide fast delivery of Internet content....
Read more >
What is a CDN (Content Delivery Network)? - Akamai
A content delivery network (CDN) is a group of geographically distributed servers that speed up the delivery of web content by bringing it...
Read more >
What is a CDN? - CDN Explained - AWS
CDN can stand for content delivery network or content distribution network. When a user visits a website, data from that website's server has...
Read more >
Content delivery network - Wikipedia
A content delivery network, or content distribution network (CDN), is a geographically distributed network of proxy servers and their data centers.
Read more >
Cloud CDN: Content Delivery Network - Google Cloud
Supports hybrid and multicloud architecture. Cloud CDN enables customers to deliver content hosted on-premises or in another cloud over Google's high- ...
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