Skip to content

Instantly share code, notes, and snippets.

@jschr
Last active April 12, 2017 04:13
Show Gist options
  • Save jschr/ad354ca97383777e4d5d44de939d2784 to your computer and use it in GitHub Desktop.
Save jschr/ad354ca97383777e4d5d44de939d2784 to your computer and use it in GitHub Desktop.
webpack config step 2
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