After attempting to prerender the routes of my SPA using the npm package prerender-spa-plugin with Vue CLI 3, I received a satisfactory output. However, upon running "npm run build," I encountered an error in the index.html file.
The error displayed in the index.html file is as follows:
<html>
<head>
</head>
<body>Html Webpack Plugin:
<pre> ReferenceError: BASE_URL is not defined
- index.html:96
C:/Users/Fred/v2/public/index.html:96:11
- index.html:99 0971.module.exports
C:/Users/Fred/v2/public/index.html:99:3
- index.js:284 Promise.resolve.then
[v2]/[html-webpack-plugin]/index.js:284:18
</pre>
</body>
</html>
The content of my vue.config.js file is provided below:
const path = require('path');
const PrerenderSPAPlugin = require('prerender-spa-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
configureWebpack: {
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
inject: false
}),
new PrerenderSPAPlugin({
staticDir: path.join(__dirname, './dist'),
routes: ['/', '/about', '/details/:id', '/activities', '/activity/:id', '/associations', '/association/:id', '/events', '/event/:id', '/gdpr', '/institutions', '/institution/:id', '/login', '/news', '/news/:id', '/contact', '/registrations'],
})
],
},
};
Upon executing "npm run build" in VSCode, it appears to be stuck on "Building for production..." without any progress. Does anyone have insights into this problem?