diff --git a/packages/server/src/ChunkExtractor.js b/packages/server/src/ChunkExtractor.js index 1497a71a..b7b63e1e 100644 --- a/packages/server/src/ChunkExtractor.js +++ b/packages/server/src/ChunkExtractor.js @@ -19,7 +19,10 @@ function extensionToScriptType(extension) { } function getAssets(chunks, getAsset) { - return uniqBy(flatMap(chunks, chunk => getAsset(chunk)), 'url') + return uniqBy( + flatMap(chunks, chunk => getAsset(chunk)), + 'url', + ) } function handleExtraProps(asset, extraProps) { @@ -411,6 +414,7 @@ class ChunkExtractor { const preloadAssets = this.getChunkChildAssets(chunks, 'preload') const prefetchAssets = this.getChunkChildAssets(chunks, 'prefetch') return [...mainAssets, ...preloadAssets, ...prefetchAssets] + .sort(a => (a.scriptType === 'style' ? -1 : 0)) } getLinkTags(extraProps = {}) { diff --git a/yarn.lock b/yarn.lock index 2bab7ff9..24801649 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6531,6 +6531,13 @@ make-dir@^2.0.0, make-dir@^2.1.0: pify "^4.0.1" semver "^5.6.0" +make-dir@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" + integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== + dependencies: + semver "^6.0.0" + make-fetch-happen@^5.0.0: version "5.0.2" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz#aa8387104f2687edca01c8687ee45013d02d19bd"