Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Preload js assets - fixes #408 #712

Closed
wants to merge 2 commits into from

Conversation

greensk
Copy link

@greensk greensk commented May 24, 2019

Alternative to #440, fixes #408.

Preloading scripts content is important to supply good Google site speed rate. The #440 PR looks outdated so I implemented an own solution.

@greensk
Copy link
Author

greensk commented May 30, 2019

Fixed the webpack build issue.

@RobbieTheWagner
Copy link

What's the status on this? I'm getting dinged by google for not having preload.

@greensk
Copy link
Author

greensk commented Sep 26, 2019

@rwwagner90 @matt3224 if it important for you try to install sapper from my branch. Please let me know if you get any issues.

@@ -38,6 +39,22 @@ export default class RollupResult implements CompileResult {
// webpack, but we can have a route -> [chunk] map or something
this.assets = {};

this.script_preloads = {}
const entryChunk = compiler.chunks.find(ch => ch.isEntry)
const addImportsToScripsPreload = (facadeModuleId:string, chunk:Chunk) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "scrips"

@benmccann
Copy link
Member

I've sent #1269 which handles transitive JS dependencies as well as CSS files

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preloading assets in Rollup apps
3 participants