diff --git a/vue.config.js b/vue.config.js index ed054da..ef127ff 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,6 @@ const path = require('path'); const prettier = require('prettier'); +const NodePolyfillPlugin = require('node-polyfill-webpack-plugin'); module.exports = { publicPath: '', @@ -17,20 +18,23 @@ module.exports = { .end(); }, configureWebpack: { - plugins: process.env.DEPLOY - ? [ - new (require('prerender-spa-plugin'))({ - staticDir: path.join(__dirname, 'dist'), - routes: ['/'], - postProcess(renderedRoute) { - renderedRoute.html = prettier - .format(renderedRoute.html, { filepath: 'index.html', printWidth: 120 }) - .replace('render', 'prerender') - .replace(/(data-v-[0-9a-f]+)=""/gm, '$1'); - return renderedRoute; - }, - }), - ] - : [], + plugins: [ + new NodePolyfillPlugin(), + ...(process.env.DEPLOY + ? [ + new (require('prerender-spa-plugin'))({ + staticDir: path.join(__dirname, 'dist'), + routes: ['/'], + postProcess(renderedRoute) { + renderedRoute.html = prettier + .format(renderedRoute.html, { filepath: 'index.html', printWidth: 120 }) + .replace('render', 'prerender') + .replace(/(data-v-[0-9a-f]+)=""/gm, '$1'); + return renderedRoute; + }, + }), + ] + : []), + ], }, };