Skip to content

[SPFx 1.15.0-beta.1] package-solution fails when elements.xml file is referenced from external folder and sharepoint/assets doesn't exist #7826

@NickSevens

Description

@NickSevens

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

  • 💥 Internet Explorer
  • 💥 Microsoft Edge
  • 💥 Google Chrome
  • 💥 FireFox
  • 💥 Safari
  • mobile (iOS/iPadOS)
  • mobile (Android)
  • not applicable
  • other (enter in the "Additional environment details" area below)

Additional environment details

  • SPFx version: 1.15.0-beta.1

Describe the bug / error

While working in a monorepo, we reference our elements.xml feature files to be included in the .sppkg package from another project in the monorepo.

When running gulp package-solution this task fails when there is no sharepoint/assets folder in the project the command is run.

PS: follow-up on fixes in #7689

Steps to reproduce

Project structure

<root>
├───apps
│   └───demoapp
│       ├───config
│       │   ├───package-solution.json
│       │   └───...
│       ├───gulpfile.js
│       └───...
├───node_modules
│   └───@mycompany
│       └───appcustomizer
│           └───...
├───packages
│   └───appcustomizer
│       ├───config
│       ├───sharepoint
│       │   └───assets
│       │       └───elements.xml
│       └───src
└───package.json

apps/demoapp/config/package-solution.json

{
	"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
	"solution": {
		"name": "connect-demo",
		"id": "054bb688-3365-4121-ad60-e870f10518cb",
		"version": "1.1.0.0",
		"includeClientSideAssets": true,
		"skipFeatureDeployment": true,
		...
		"features": [
			{
				"title": "App Components",
				"description": "...",
				"id": "...",
				"version": "1.1.0.0",
				"assets": {
					"elementManifests": ["@mycompany/appcustomizer/sharepoint/assets/elements.xml"]
				}
			}
		]
	},
	"paths": {
		"zippedPackage": "solution/demoapp.sppkg"
	}
}

Behaviour

Running this:

cd apps/demoapp
gulp package-solution

... returns with this error message:

[12:10:26] [package-solution] Normalizing solution information...
[12:10:26] [package-solution] Attempting creating component definitions for {9} manifests
[12:10:26] [package-solution] Created component definitions for {9} manifests
[12:10:26] [package-solution] feature.componentIds not set! Adding all [9] components to feature { App Components }.
[12:10:26] Error - [package-solution]
[12:10:26] Error - [package-solution] Error: File does not exist: C:\<root>\apps\demoapp\sharepoint
ENOENT: no such file or directory, lstat 'C:\<root>\apps\demoapp\sharepoint'
    at Object.realpathSync (fs.js:1646:7)
    at C:\<root>\node_modules\@rushstack\node-core-library\lib\FileSystem.js:903:24
    at Function._wrapException (C:\<root>\node_modules\@rushstack\node-core-library\lib\FileSystem.js:1034:20)
    at Function.getRealPath (C:\<root>\node_modules\@rushstack\node-core-library\lib\FileSystem.js:902:27)
    at Function.resolveModule (C:\<root>\node_modules\@rushstack\node-core-library\lib\Import.js:146:60)
    at resolveFeatureFile (C:\<root>\node_modules\@microsoft\spfx-heft-plugins\lib\plugins\packageSolutionPlugin\packageSolution\utils\normalizeSolutionDefinition.js:234:43)
    at C:\<root>\node_modules\@microsoft\spfx-heft-plugins\lib\plugins\packageSolutionPlugin\packageSolution\utils\normalizeSolutionDefinition.js:226:40
    at Array.map (<anonymous>)
    at resolveFeatureFiles (C:\<root>\node_modules\@microsoft\spfx-heft-plugins\lib\plugins\packageSolutionPlugin\packageSolution\utils\normalizeSolutionDefinition.js:226:22)
    at normalizeSolutionDefinition (C:\<root>\node_modules\@microsoft\spfx-heft-plugins\lib\plugins\packageSolutionPlugin\packageSolution\utils\normalizeSolutionDefinition.js:210:47)
[12:10:26] Error - 'package-solution' sub task errored after 178 ms
 File does not exist: C:\<root>\apps\demoapp\sharepoint
ENOENT: no such file or directory, lstat 'C:\<root>\apps\demoapp\sharepoint'

Metadata

Metadata

Assignees

Labels

area:spfxCategory: SharePoint Framework (not extensions related)status:fixed-next-dropIssue planned to be fixed in an upcoming release.type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions