-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add build manifest * Split out css since they don’t have exact name * Remove pages map * Fix locations test * Re-run tests * Get consistent open ports * Fix static tests * Add comment about Cache-Control header
- Loading branch information
1 parent
769d8e3
commit 15dde33
Showing
17 changed files
with
125 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// @flow | ||
import { RawSource } from 'webpack-sources' | ||
import {BUILD_MANIFEST} from '../../../lib/constants' | ||
|
||
// This plugin creates a build-manifest.json for all assets that are being output | ||
// It has a mapping of "entry" filename to real filename. Because the real filename can be hashed in production | ||
export default class BuildManifestPlugin { | ||
apply (compiler: any) { | ||
compiler.plugin('emit', (compilation, callback) => { | ||
const {chunks} = compilation | ||
const assetMap = {pages: {}, css: []} | ||
|
||
for (const chunk of chunks) { | ||
if (!chunk.name || !chunk.files) { | ||
continue | ||
} | ||
|
||
const files = [] | ||
|
||
for (const file of chunk.files) { | ||
if (/\.map$/.test(file)) { | ||
continue | ||
} | ||
|
||
if (/\.hot-update\.js$/.test(file)) { | ||
continue | ||
} | ||
|
||
if (/\.css$/.exec(file)) { | ||
assetMap.css.push(file) | ||
continue | ||
} | ||
|
||
files.push(file) | ||
} | ||
|
||
if (files.length > 0) { | ||
assetMap[chunk.name] = files | ||
} | ||
} | ||
|
||
compilation.assets[BUILD_MANIFEST] = new RawSource(JSON.stringify(assetMap)) | ||
callback() | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.next-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
module.exports = { | ||
exportPathMap: function () { | ||
return { | ||
'/': { page: '/' }, | ||
'/about': { page: '/about' }, | ||
'/asset': { page: '/asset' }, | ||
'/button-link': { page: '/button-link' }, | ||
'/get-initial-props-with-no-query': { page: '/get-initial-props-with-no-query' }, | ||
'/counter': { page: '/counter' }, | ||
'/dynamic-imports': { page: '/dynamic-imports' }, | ||
'/dynamic': { page: '/dynamic', query: { text: 'cool dynamic text' } }, | ||
'/dynamic/one': { page: '/dynamic', query: { text: 'next export is nice' } }, | ||
'/dynamic/two': { page: '/dynamic', query: { text: 'zeit is awesome' } }, | ||
'/file-name.md': { page: '/dynamic', query: { text: 'this file has an extension' } } | ||
const {PHASE_DEVELOPMENT_SERVER} = require('next/constants') | ||
|
||
module.exports = (phase) => { | ||
return { | ||
distDir: phase === PHASE_DEVELOPMENT_SERVER ? '.next-dev' : '.next', | ||
exportPathMap: function () { | ||
return { | ||
'/': { page: '/' }, | ||
'/about': { page: '/about' }, | ||
'/asset': { page: '/asset' }, | ||
'/button-link': { page: '/button-link' }, | ||
'/get-initial-props-with-no-query': { page: '/get-initial-props-with-no-query' }, | ||
'/counter': { page: '/counter' }, | ||
'/dynamic-imports': { page: '/dynamic-imports' }, | ||
'/dynamic': { page: '/dynamic', query: { text: 'cool dynamic text' } }, | ||
'/dynamic/one': { page: '/dynamic', query: { text: 'next export is nice' } }, | ||
'/dynamic/two': { page: '/dynamic', query: { text: 'zeit is awesome' } }, | ||
'/file-name.md': { page: '/dynamic', query: { text: 'this file has an extension' } } | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.