-
Notifications
You must be signed in to change notification settings - Fork 1k
Web Part Missing in Toolbox After Running Gulp Serve #10053
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
Comments
@Sucharita993 - thank you for reporting the issue. In a meanwhile, as a workaround, copy all the generated files from |
Here is the gulptask you can add to your // add these after const build = require('@microsoft/sp-build-web');
const fs = require('fs');
const path = require('path');
// Insert this code before build.initialize(require('gulp'));
const copyTask = build.subTask('copy-to-build', function (gulp, buildOptions, done) {
const srcFolder = './temp';
const destFolder = './temp/build';
// Check if the destination folder exists, if not, create it
if (!fs.existsSync(destFolder)) {
fs.mkdirSync(destFolder, { recursive: true });
}
// Copy files from srcFolder to destFolder, excluding destFolder itself
return gulp.src([path.join(srcFolder, '**/*'), '!' + destFolder])
.pipe(gulp.dest(destFolder));
});
build.rig.addPostBundleTask(copyTask); |
Hello @Sucharita993, |
@Sucharita993, |
I just tried to test the new SPFx 1.21-rc.0 release with a newly scaffolded webpart but I think, this issue still exists. I still get the warning message, but when I close it, I can find the webpart in the list and add it to the workbench. @AJIXuMuK should we still update the gulpfile.js manually? I do not know if it is releated, but it seems, that the *.scss is not loaded as well. (e.g. HelloWorld.module.scss). But it could be an issue with the RC as well. |
I also facing the same issue . webpart is not loading in toolbox. |
just created a brand new 1.21 SPFX project. ran gulp serve, and I got the same warning. So, still an issue. |
Also just tried a vanilla webpart (no framework) and am seeing the same problem. SPFx: 1.21.0 ![]() As you can see, the webpart is already added to the workbench at this point, but will still show this warning on refresh. Dismissing this allows you to select the webpart after at least one refresh after the first time you get the warning. You can also see styles are not being applied. Looking in the style module you can see the postfix being added: ![]() But when you check the styles in the browser you can see they've got an extra postfix: ![]() Adding @AJIXuMuK's gulp script from above seemed to have no effect. But that's assuming I did it right. Rolling back to SPFx 1.20.0 (Node 18.20.3) worked perfectly. Looks like we're gonna need an SPFx 1.21.1 |
I'm also seeing the same issue. I logged a bug (#10207) which now has a reference to this one. |
I was playing around to avoid the multiple hashes: Webpack config adds hashes, and this is too much. gulpfile.js
Output:
After that, it looks as expected: @thechriskent if you have time can you validate my solution? and yes the code is ugly |
I can confirm that adopting @petkir's gulp file changes fixes the issue for me with the vanilla webpart. In fact, I'm not seeing either the webpart missing error dialog or the missing styles. Nice! Regardless, I'm sticking with 1.20 for now. Teaching a workshop next week and having them add a temporary work around isn't going to be a good experience. Fortunately, seems like a 1.21.1 may not be such a hard ask. |
This is now a combination of two issues unfortunately - so providing an update for both of them.
Thanks everyone for your invaluable input on the issues. This will help others in the ecosystem to know about the issues and it helps engineering to address regressions and bugs as fast as possible. Sorry for the inconvenience - fixes incoming. |
Specifically for the styling issues - we have now pushed 1.21.1 to address that. Release notes at https://learn.microsoft.com/en-us/sharepoint/dev/spfx/release-1.21.1 Workbench misleading warning is fixed and checked in to server side code. Will start rolling to production soon. |
1.21.1 is working as expected 👍 |
1.21.1 is working as expected! Thank you. |
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
💥 SharePoint Framework
Developer environment
Windows
What browser(s) / client(s) have you tested
Additional environment details
Describe the bug / error
After running the gulp serve command to launch an existing SPFx project locally, the web part is not appearing in the toolbox. It was functioning perfectly until December 11th, but the issue began on December 12th.
Steps to reproduce
gulp serve
in cmdExpected behavior
Expected the webpart to be listed under local category.
The text was updated successfully, but these errors were encountered: