-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Scripts: Improve the handling for build entry points #38584
Conversation
Size Change: 0 B Total Size: 1.14 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This is going to really improve the dev experience!
This prevents passing custom entry point in our workflow. Exemple: import config from "../../config.js"
/** Gulp and utils **/
import gulp from 'gulp'
const {src, dest} = gulp
import named from 'vinyl-named'
/** Webpack **/
import webpack from 'webpack-stream'
import webpackConfig from "@wordpress/scripts/config/webpack.config.js"
webpackConfig.entry = null
/**
* Scripts
*/
export const process_js = () => src( config.paths.scripts_sources.src )
.pipe( named() )
.pipe( webpack( webpackConfig ) )
.pipe( dest( config.paths.scripts_sources.dst ) ) Returns the error:
Please revert: if ( ! entryFile ) {
log(
chalk.bold.red( 'No entry files discovered in the "src" folder.' )
);
exit( 1 );
}
to if ( ! entryFile ) {
return {};
} |
@loxK, I see what happened. https://webpack.js.org/concepts/entry-points/#object-syntax Thank you for the report. I will work on the fix today and publish hotfix to npm 👍🏻 |
@gziolo awesome thank you |
|
Description
Fixes #38526.
As reported by @markcummins:
I resolved the issue by removing the path to the
src
directory in the project instead of splitting the path by the location ofsrc/
.In addition to that, I added warnings and errors with detailed description what can be improved in the configuration.
Testing Instructions
Run:
Try removing a script referenced in the
block.json
and run the build again:You should see an error message.
Try adding in
block.json
a path to a script that is outside ofsrc
folder and watch for warning when running the build again.Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).