Last active
October 16, 2018 09:23
-
-
Save littledian/a71b9f4b2224f6e0f486130ff0042d6c to your computer and use it in GitHub Desktop.
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
| const path = require('path') | |
| const PrerenderSPAPlugin = require('prerender-spa-plugin') | |
| const Renderer = PrerenderSPAPlugin.PuppeteerRenderer | |
| module.exports = { | |
| configureWebpack: config => { | |
| if (process.env.NODE_ENV === 'production') { | |
| // 为生产环境修改配置... | |
| config.plugins.push( | |
| new PrerenderSPAPlugin({ | |
| staticDir: path.join(__dirname, 'dist'), | |
| routes: [ '/', '/about' ], | |
| renderer: new Renderer({ | |
| inject: { | |
| foo: 'bar' | |
| }, | |
| headless: false, | |
| renderAfterDocumentEvent: '' | |
| }) | |
| }) | |
| ) | |
| } else { | |
| // 为开发环境修改配置... | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment