当我在我的租户站点中部署它时出现错误,但是当我通过gulp serve
应用程序在调试模式下运行它时正在呈现。
这是错误:
Uncaught (in promise) Error
at t [as constructor]
Uncaught (in promise) Error: Failed to create application customizer 'ClientSideExtension.ApplicationCustomizer.75e06db2-212d-41f4-ad01-758e014c7b40'. Error information is 'Extension failed to load for componentId "75e06db2-212d-41f4-ad01-758e014c7b40".'.
我安装了所有需要的依赖项并且它短暂工作但是当我删除底部占位符自定义时,部署然后它不再呈现了。我还想指出,当它短暂工作时,它只呈现在网站内容、文档、设置中,它没有呈现在我的主页和我创建的其他页面等网站页面中。
我在构建定制器时遵循了文档:
private _renderPlaceHolders(): void {
console.log("HelloWorldApplicationCustomizer._renderPlaceHolders()");
console.log(
"Available placeholders: ",
this.context.placeholderProvider.placeholderNames
.map(name => PlaceholderName[name])
.join(", ")
);
// Handling the top placeholder
if (!this._topPlaceholder) {
console.log("no placeholder found");
this._topPlaceholder = this.context.placeholderProvider.tryCreateContent(
PlaceholderName.Top,
{ onDispose: this._onDispose }
);
// The extension should not assume that the expected placeholder is available.
if (!this._topPlaceholder) {
console.error("The expected placeholder (Top) was not found.");
return;
}
//MORE CODE BELOW
}
}
我的 package.json
{
"name": "searchbar-ext",
"version": "0.0.1",
"private": true,
"main": "lib/index.js",
"scripts": {
"build": "gulp bundle",
"clean": "gulp clean",
"test": "gulp test"
},
"dependencies": {
"@microsoft/decorators": "1.11.0",
"@microsoft/sp-application-base": "1.11.0",
"@microsoft/sp-core-library": "1.11.0",
"@microsoft/sp-dialog": "1.11.0",
"@microsoft/sp-http": "1.11.0",
"@microsoft/sp-office-ui-fabric-core": "1.11.0",
"@pnp/common": "^2.5.0",
"@pnp/graph": "^2.5.0",
"@pnp/logging": "^2.5.0",
"@pnp/odata": "^2.5.0",
"@pnp/pnpjs": "^2.0.13",
"@pnp/sp": "^2.5.0",
"@types/rijndael-js": "^1.0.0",
"crypto-js": "^4.0.0",
"dayjs": "^1.10.5",
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"gulp-cli": "^2.3.0",
"js-cookie": "^2.2.1",
"ncrypt-js": "^2.0.0",
"react-cookie": "^4.0.3",
"rijndael-js": "^2.0.0"
},
"devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5",
"@microsoft/sp-build-web": "1.11.0",
"@microsoft/sp-module-interfaces": "1.11.0",
"@microsoft/sp-tslint-rules": "1.11.0",
"@microsoft/sp-webpart-workbench": "1.11.0",
"@types/js-cookie": "^2.2.6",
"@types/react-cookies": "^0.1.0",
"@types/webpack-env": "1.13.1",
"ajv": "~5.2.2",
"gulp": "3.9.1",
"gulp-sequence": "1.0.0",
"sass-loader": "^8.0.2",
"spfx-uifabric-themes": "^0.8.0",
"ts-loader": "^6.2.1"
}
}