Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flow, pages-manifest.json, defaultPathMap for export (minor) #4066

Merged
merged 12 commits into from
Mar 30, 2018

Conversation

timneutkens
Copy link
Member

@timneutkens timneutkens commented Mar 27, 2018

  • Add flow
  • Add pages-manifest.json that holds a mapping of page => js-file this is now used for resolving pages in require.js and to generate the defaultPathMap for next export. It also gives a major performance boost (again) because we don't have to hit the filesystem for non-existent pages 馃憣
  • Create defaultPathMap based on pages-manifest.json
  • Allow next export to be ran without exportPathMap

@timneutkens timneutkens changed the title [WIP] Allow next export to be ran without exportPathMap (minor) [WIP] (minor) Mar 28, 2018
@timneutkens timneutkens changed the title [WIP] (minor) Add flow, pages-manifest.json, defaultPathMap for export (minor) Mar 29, 2018
Copy link
Contributor

@arunoda arunoda left a comment

Choose a reason for hiding this comment

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

Everything looks great with the functionality.
But we do some little improvements.

.flowconfig Outdated
@@ -0,0 +1,3 @@
[ignore]
<PROJECT_ROOT>/examples/.*
<PROJECT_ROOT>/examples/.*
Copy link
Contributor

Choose a reason for hiding this comment

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

Why two instances of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

import { MATCH_ROUTE_NAME } from '../../utils'
import {PAGES_MANIFEST} from '../../../lib/constants'

export default class PagesManifestPlugin {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we add a comment on what this plugin is about

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

'> "next export" uses that function to build html pages.'
)
console.log('> No "exportPathMap" found in "next.config.js". Generating map from "./pages"')
nextConfig.exportPathMap = async (defaultMap) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Log a message on this is exporting all the pages or something similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Generating map from "./pages" seems clear to me 馃 @rauchg wrote the specific text update.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean the Generating map from "./pages".
It's bit of unclear what's map is. If the user created the exportPathMap before it's clear.
Otherwise, he/she might be looking at what's this map is.

@@ -1,5 +1,5 @@
import {join, parse, normalize, sep} from 'path'
import fs from 'mz/fs'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove mz with this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, it's still used, but there's another PR to remove it.

@timneutkens timneutkens merged commit e90f896 into vercel:canary Mar 30, 2018
@timneutkens timneutkens deleted the add/default-export-pathmap branch March 30, 2018 13:08
@lock lock bot locked as resolved and limited conversation to collaborators Mar 30, 2019
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.

None yet

3 participants