SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.24k stars 1k forks source link

Spfx 1.18 fails to compile with --use-heft #9073

Open stevebeauge opened 1 year ago

stevebeauge commented 1 year ago

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

SPFX generator with --use-heft produces non compilable project.

Running build script results in error:

Error: Resolved configuration object does not match schema: Error: JSON validation failed: D:\protos\spfx-1.18\node_modules\@microsoft\spfx-web-build-rig\profiles\default\config\heft.json

I found another issue (#8767) related to heft, but symptoms are not the same at all.

The expectation of using heft is to be able to work in a large monorepo where some "leaf" projects are SPFX projects that should consume shared packages.

Steps to reproduce

  1. Bootstrap a new webpart project with the next version of generator.

    I use this command line:

    pnpm --package yo@latest --package @microsoft/generator-sharepoint@next dlx yo @microsoft/sharepoint@next --skip-install --package-manager pnpm --use-heft 

    Followed by generator series of questions (choose WebPart type + react in my case), and a pnpm i to install the dependencies.

  2. Try to build

    pnpm run build

Results in:

> spfx-with-heft@0.0.1 build D:\protos\spfx-1.18
> heft test --clean

Error: Resolved configuration object does not match schema: Error: JSON validation failed:
D:\protos\spfx-1.18\node_modules\@microsoft\spfx-web-build-rig\profiles\default\config\heft.json

Error: #/ (Defines configuration used by core Heft.)
       Additional properties not allowed: eventActions
Error: #/heftPlugins/5 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/5 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
Error: #/heftPlugins/4 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/4 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
Error: #/heftPlugins/3 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/3 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
Error: #/heftPlugins/2 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/2 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
Error: #/heftPlugins/1 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/1 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
Error: #/heftPlugins/0 (A plugin that can be used to extend H...)
       Missing required property: pluginPackage
Error: #/heftPlugins/0 (A plugin that can be used to extend H...)
       Additional properties not allowed: plugin
 ELIFECYCLE  Command failed with exit code 1.

Expected behavior

Generated project should compile with --use-heft flag

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

AJIXuMuK commented 1 year ago

@stevebeauge - we're currently working on some changes for the Heft. When it's done we will update SPFx solutions to correctly use Heft.

stevebeauge commented 1 year ago

Thanks @AJIXuMuK

Can we expect this update to be available with 1.18 RTM ? Or any aprox. ETA?

ltdu commented 1 year ago

It seems as of v1.18-rc1, original problem is resolved. However, new problem is present:

PS C:\Solutions\Experiments\spfx-1.18-rc1> pnpm build

> spfx-1-18-rc-1@0.0.1 build C:\Solutions\Experiments\spfx-1.18-rc1
> heft test --clean

Error: File does not exist: C:\Solutions\Experiments\spfx-1.18-rc1\node_modules\.pnpm\@microsoft+spfx-heft-plugins@1.18.0-rc.1\node_modules\@microsoft\spfx-heft-plugins\heft-plugin.json
File does not exist: C:\Solutions\Experiments\spfx-1.18-rc1\node_modules\.pnpm\@microsoft+spfx-heft-plugins@1.18.0-rc.1\node_modules\@microsoft\spfx-heft-plugins\heft-plugin.json
ENOENT: no such file or directory, open 'C:\Solutions\Experiments\spfx-1.18-rc1\node_modules\.pnpm\@microsoft+spfx-heft-plugins@1.18.0-rc.1\node_modules\@microsoft\spfx-heft-plugins\heft-plugin.json'
 ELIFECYCLE  Command failed with exit code 1.

I checked NPMJS and indeed package @microsoft\spfx-heft-plugins is missing heft-plugin.json file. This seems like an easy fix because I was able to manually create patched version of this package and build started to work (kinda...)

Waiting with anticipation for next release :)

AJIXuMuK commented 1 year ago

Heft is still in the broken state unfortunately and will not be fixed in 1.18.