Last active
April 12, 2017 04:13
-
-
Save jschr/ad354ca97383777e4d5d44de939d2784 to your computer and use it in GitHub Desktop.
webpack config step 2
This file contains hidden or 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
import getProps from './getProps' | |
// webpack supports exporting a function in your config | |
// without needing any changes to start the dev server | |
export default async function createWebpackConfig() { | |
// fetch our latest app props | |
const appProps = await getProps({ | |
// variable set by dotenv for development | |
github: process.env.GITHUB_USERNAME | |
}) | |
// return the new config with new props | |
return { | |
... | |
plugins: [ | |
new StaticSiteGeneratorPlugin({ | |
paths: ['/'], | |
locals: { | |
// pass app props into locals | |
appProps | |
} | |
}) | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment