There is a new CLI flag --flush which will force a full recompilation if you feel like something is goofy. It’s also recommended to run bud clean after installing an update.
Notifier
MacOS notification center notices are fixed. If you don’t want them run the cli command with the --no-notify flag.
bud.path and bud.setPath
TLDR: Way less clunky to work with.
bud.path() can be called with no parameters will now resolve to the project root.
bud.path('relative/path') now returns an absolute path from a project relative one.
bud.path('/absolute/path') is recognized as an absolute path and will not be interpolated.
There are several reserved strings referencing key directories: @src, @dist, @storage, @modules. The @ prefix is now being used to make it clearer that this is not a normal path.
You can use bud.setPath to define additional directory aliases:
Extension authors should take advantage of how all properties for loader, item, and rule definitions can be expressed with a callback. This means if someone changes their source path later your rule will still be pointed in the right direction.
I get this Error when ugradingto 5.6, running on 5.5 works fine?
[webpack-dev-middleware] Error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at /Users/bjorn/Projects/Sites/kyrkjebygd.test/web/app/themes/kyrkjebygdheia/node_modules/@roots/sage/lib/cjs/theme/plugin.js:18:23
My bud config.
/**
* @typedef {import('@roots/bud').Bud} bud
*
* @param {bud} app
*/
module.exports = async (app) => {
app
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: ['@scripts/app', '@styles/app'],
banner: ['@scripts/banner'],
editor: ['@scripts/editor', '@styles/editor'],
})
/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets('images')
/**
* 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('http://kyrkjebygdheia.test')
/**
* Development URL
*/
.serve('http://kyrkjebygdheia.test:3000')
/**
* Generate WordPress `theme.json`
*
* @note This overwrites `theme.json` on every build.
*/
.themeJson({
color: {
custom: false,
customGradient: false,
defaultPalette: false,
defaultGradients: false
},
custom: {
spacing: {},
typography: {
fontSize: {},
lineHeight: {}
}
},
spacing: {
padding: true,
units: ["px", "%", "em", "rem", "vw", "vh"]
},
typography: {
customFontSize: false
}
})
/**
* Set `theme.json` colors from `tailwind.config.js` values
*/
.useTailwindColors();
};
TypeError: mod.require is not a function
at dynamicRequire ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:4683:14)
at Object.exports.install ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:5307:16)
at installSourceMapSupport ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:127001:26)
at create ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:126999:5)
at register ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:126862:19)
at Bud.read ([secure]/node_modules/@roots/bud-support/lib/cjs/index.js:133020:9)
at [secure]/node_modules/@roots/bud/lib/cjs/services/Project/project.service.js:169:45
at Array.map (<anonymous>)
at Project.searchConfigs ([secure]/node_modules/@roots/bud/lib/cjs/services/Project/project.service.js:151:72)
at Project.boot ([secure]/node_modules/@roots/bud/lib/cjs/services/Project/project.service.js:88:20)
Am I missing something? Cleared yarn cache, re-install but no success…
I’ve got a problem now for compiling scss. It gives an error: Unexpected character ‘@’.
When I try to set a custom loader with your example it gives me the following error:
TypeError: Cannot read properties of undefined (reading 'toWebpack')
at [secure]/node_modules/@roots/bud-build/lib/cjs/Rule/index.js:186:75
at Array.map (<anonymous>)
at Rule.toWebpack ([secure]/node_modules/@roots/bud-build/lib/cjs/Rule/index.js:186:36)
at [secure]/node_modules/@roots/bud-build/lib/cjs/Build/config/builder.js:39:101
at Array.map (<anonymous>)
at [secure]/node_modules/@roots/bud-build/lib/cjs/Build/config/builder.js:39:84
at [secure]/node_modules/@roots/bud-hooks/lib/cjs/Hooks/index.js:169:42
at Array.reduce (<anonymous>)
at Hooks.filter ([secure]/node_modules/@roots/bud-hooks/lib/cjs/Hooks/index.js:168:23)
at [secure]/node_modules/@roots/bud-build/lib/cjs/Build/config/builder.js:35:30
How to fix this? Scss compiled fine before the update.
Module parse failed: Unexpected character '@' (2:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders // Import default style @import 'default';
Now I run into the following problem. I enabled sourcemap by setting devtool(‘eval’).
When this setting is enabled the builder gives me an error about sourcemap option has to be a boolean. So setting something different than false or devtool() is not working.
How do i fix this, because the eval option is great for developing.
Module build failed (from ./node_modules/css-loader/dist/cjs.js): │
│ ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema. │
│ - options.sourceMap should be a boolean. │
│ -> Allows to enable/disable source maps. │
│ -> Read more at https://github.com/webpack-contrib/css-loader#sourcemap │
│ at validate (/Users/gydoverbeek/Documents/Projects/brilonline-website/node_modules/schema-utils/dist/validate.js:105:11) │
│ at Object.getOptions (/Users/gydoverbeek/Documents/Projects/brilonline-website/node_modules/webpack/lib/NormalModule.js:580:19) │
│ at Object.loader (/Users/gydoverbeek/Documents/Projects/brilonline-website/node_modules/css-loader/dist/index.js:31:27)
hm…
I have same problem in sage theme 10.1.6
I just add to config
.devtool(‘eval’)
my env:
mode development
bud 5.7.6
webpack 5.70.0
node v17.5.0
Module build failed (from ./node_modules/css-loader/dist/cjs.js): │
│ ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema. │
│ - options.sourceMap should be a boolean. │
│ -> Allows to enable/disable source maps. │
│ -> Read more at https://github.com/webpack-contrib/css-loader#sourcemap │
│ at validate (/Users/bit/containers/newformat/src/public/wp-content/themes/newformat/node_modules/schema-utils/dist/validate.js:105:11) │
│ at Object.getOptions (/Users/bit/containers/newformat/src/public/wp-content/themes/newformat/node_modules/webpack/lib/NormalModule.js:585:19) │
│ at Object.loader (/Users/bit/containers/newformat/src/public/wp-content/themes/newformat/node_modules/css-loader/dist/index.js:31:27)
@Gydo_Verbeek@webspilka I noticed this over the weekend but hadn’t seen this thread until this evening.
Couple updates:
First, I submitted the fix for it a couple days ago:
Second, tonightI added a test spec for bud.devtool in honor of the time lost on this:
This will be included in the next release. In the meantime this is an easy fix –
The bud.devtool function is an extremely thin wrapper around a simple hook:
bud.hooks.on('build.devtool', 'source-map')
Or, using a callback. Will be passed the current value, if it is exists:
bud.hooks.on('build.devtool', v => 'source-map')
You can pass whatever options webpack accepts as the second param. Heads up that false is not an acceptable devtool value and will cause webpack to throw. You’ll want to pass undefined to disable:
bud.hooks.on('build.devtool', undefined)
Since you’re using TS you should get type hinting for the value. bud.hooks.on returns the Bud instance, so you’re good to just add it to the fn chain.