-
-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Agreement
- This is not a duplicate of an existing issue
- I have read the guidelines for Contributing to Roots Projects
- This is not a personal support request that should be posted on the Roots Discourse community
Describe the issue
I have a directory inside publicPath that I would like to exclude from cleanup.
This is my public path setting:
app.setPublicPath('/app/themes/sage/public/');
According to bud documentation on extensions, I've tried configuring this in bud.config.js as follows:
app.extensions.get('@roots/bud-extensions/clean-webpack-plugin').set('cleanOnceBeforeBuildPatterns', [`**/*`, `!vendor/**`]);
However, this doesn't work. When I run bud build, the vendor directory inside /public is still removed.
I also tried completely disabling the extension, but that doesn't seem to work either:
app.extensions.get('@roots/bud-extensions/clean-webpack-plugin').disable();
vendor directory isn't part of bud setup, it's just directory that contains livewire esm file published via acorn using command wp acorn vendor:publish --tag=livewire:assets
By the way, I believe there is an error in the documentation: https://bud.js.org/learn/general-use/extensions#enable-a-registered-extension. The correct extension name is clean-webpack-plugin, not webpack-clean-plugin.
Expected Behavior
The yarn build command should preserve the vendor directory inside the public folder as it is excluded in extension options.
Actual Behavior
Setting an option in the extension doesn't seem to work. Additionally, it appears that I cannot disable the extension at all.
Steps To Reproduce
- Create vendor directory inside public folder
- Add configuration into bud.config.js
- Run yarn build
version
6.24.0
Logs
No response
Configuration
/**
* Compiler configuration
*
* @see {@link https://roots.io/sage/docs sage documentation}
* @see {@link https://bud.js.org/learn/config bud.js configuration guide}
*
* @type {import('@roots/bud').Config}
*/
export default async (app) => {
/**
* Application assets & entrypoints
*
* @see {@link https://bud.js.org/reference/bud.entry}
* @see {@link https://bud.js.org/reference/bud.assets}
*/
app
.entry('app', ['@scripts/app', '@styles/app'])
.entry('editor', ['@scripts/editor', '@styles/editor'])
.entry('admin', ['@scripts/admin', '@styles/admin'])
.assets(['images']);
/**
* Set public path
*
* @see {@link https://bud.js.org/reference/bud.setPublicPath}
*/
app.setPublicPath('/app/themes/sage/public/');
/**
* Development server settings
*
* @see {@link https://bud.js.org/reference/bud.setUrl}
* @see {@link https://bud.js.org/reference/bud.setProxyUrl}
* @see {@link https://bud.js.org/reference/bud.watch}
*/
app
.setUrl('https://localhost:3000')
.setProxyUrl('https://website.test')
.watch(['resources/views', 'app']);
app.serve({
ssl: true,
host: 'website.test',
cert: app.path('cert.pem'),
key: app.path('key.pem'),
});
/**
* Generate WordPress `theme.json`
*
* @note This overwrites `theme.json` on every build.
*
* @see {@link https://bud.js.org/extensions/sage/theme.json}
* @see {@link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json}
*/
app.wpjson
.setSettings({
background: {
backgroundImage: true,
},
color: {
custom: false,
customDuotone: false,
customGradient: false,
defaultDuotone: false,
defaultGradients: false,
defaultPalette: false,
duotone: [],
},
custom: {
spacing: {},
typography: {
'font-size': {},
'line-height': {},
},
},
spacing: {
padding: true,
units: ['px', '%', 'em', 'rem', 'vw', 'vh'],
},
typography: {
customFontSize: false,
},
})
.useTailwindColors()
.useTailwindFontFamily()
.useTailwindFontSize();
// app.extensions.get('@roots/bud-extensions/clean-webpack-plugin').disable();
app.extensions
.get('@roots/bud-extensions/clean-webpack-plugin')
.set('cleanOnceBeforeBuildPatterns', [`**/*`, `!vendor/**`]);
};Relevant .budfiles
No response