I updated the Bud version to 5.2.0 and it has caused some problems:
On the update notes, it is said that setPublicPath
is deprecated and I removed it, but the URL of the assets is wrong now and they are not found and a lot ChunkLoadError
errors appear.
If I add the setPublicPath
, then it shows: TypeError: app.use() requires a middleware function
.
If I remove my .use()
configuration, there are no terminal errors, but still the JS files are not found. I see on the folder structure that they are inside a vendor
folder(?).
This is my bud config:
const path = require('path')
require('dotenv').config({ path: path.resolve(__dirname, '../../../.env') })
const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin')
/**
* @typedef {import('@roots/bud').Bud} Bud
*
* @param {Bud} config
*/
module.exports = (app) =>
app
/**
* Application entrypoints`
*
* Paths are relative to your resources directory
*/
.entry({
app: ['scripts/app.js', 'styles/app.scss']
})
/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets([app.path('src', 'images')])
.assets([app.path('src', 'fonts')])
/**
* These files will trigger a full page reload
* when modified.
*/
.watch([
'tailwind.config.js',
'resources/views/**/*.blade.php',
'app/View/**/*.php'
])
/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy(process.env.WP_HOME)
.use(
new SVGSpritemapPlugin('resources/sprite/*.svg', {
output: {
filename: 'spritesheet.svg',
chunk: { keep: true },
svgo: false
}
})
)
I have no idea what to do in this case.