vanity-eth/vue.config.js
tabcat 304de45cdd
fix: builds without warnings from npm audit
add node plugin to vue webpack config
2023-01-23 10:26:59 -06:00

40 lines
1.3 KiB
JavaScript

const path = require('path');
const prettier = require('prettier');
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
publicPath: '',
chainWebpack: (config) => {
// Worker Loader
config.module
.rule('worker')
.test(/vanity\.js$/)
.use('worker-loader')
.loader('worker-loader')
.options({
inline: 'no-fallback',
filename: 'vanity.js',
})
.end();
},
configureWebpack: {
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;
},
}),
]
: []),
],
},
};