-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@wordpress/scripts can't see errors details with errorDetails.true #60111
Comments
module.exports = {
...defaultConfig,
stats: {
...defaultConfig.stats,
errors: false,
errorDetails: true,
},
} By setting this settings, the complete compilation of the file is not displayed in the console, but it's still impossible to know where the errors come from, in which file and on which line? If anyone could help me, that would be great. |
@webexpr-dhenriet, Did you figure this out. Same issue here. But I'm curious, the code scaffolded by |
@nicwinn // WordPress webpack config.
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
// Plugins.
const RemoveEmptyScriptsPlugin = require( 'webpack-remove-empty-scripts' );
// Utilities.
const path = require( 'path' );
//https://developer.wordpress.org/news/2023/04/25/how-webpack-and-wordpress-packages-interact/
//https://developer.wordpress.org/block-editor/reference-guides/packages/packages-scripts/#using-fonts-and-images
//https://github.com/WordPress/gutenberg/issues/55936#issuecomment-1916500479
// Add any a new entry point by extending the webpack config.
module.exports = {
...defaultConfig,
entry: {
'js/app': path.resolve( process.cwd(), 'src/js', 'app.js' ),
'js/editor': path.resolve( process.cwd(), 'src/js', 'editor.js' ),
'css/app': path.resolve( process.cwd(), 'src/scss', 'app.scss' ),
'css/editor': path.resolve( process.cwd(), 'src/scss', 'editor.scss' )
},
// infrastructureLogging: {
// level: 'info',
// debug: /webpack/,
// },
stats: {
...defaultConfig.stats,
errors: false,
errorDetails: true,
},
plugins: [
// Include WP's plugin config.
...defaultConfig.plugins,
// Removes the empty `.js` files generated by webpack but
// sets it after WP has generated its `*.asset.php` file.
new RemoveEmptyScriptsPlugin({
stage: RemoveEmptyScriptsPlugin.STAGE_AFTER_PROCESS_PLUGINS
})
]
}; |
Description
In a theme with a /src folder and a /build folder, I want to compile js and scss into css.
I used this example https://developer.wordpress.org/news/2023/07/19/beyond-block-styles-part-1-using-the-wordpress-scripts-package-with-themes/
With a dart-sass compilation, no problem, it's very simple.
A simple addition to the .json package is all that's needed, and every file that doesn't start with "_" will be compiled with the same name:
With @wordpress/scripts, it's still extremely complicated.
I have several errors that I can't see, I don't know which file it is on which line ?
The error message is :
The console displays the entire compilation of the scss file... Why is this ?
The /build folder has an app.asset.php file, no error detail.
For example, with dart sass if there's an error during compilation, it indicates the error line and file, compilation stops, it doesn't display the entire compiled file in the console.
So I put this in webpack.config.js
In webpack.config.js and package.json :
Now the error message is :
So that doesn't display anything else ?
Errors comes from background images path .
But more importantly, how to display errors and not display 14000 lines in the console ?
Step-by-step reproduction instructions
install @wordpress/scripts
/src/scss with multiples files
have errors in scss files
Screenshots, screen recording, code snippet
Environment info
node v18.12.1
webpack 5.91.0
windows 10pro
@wordpress/scripts": "^27.4.0"
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
No
The text was updated successfully, but these errors were encountered: