SPFx webpack 加载器已定义,但仍然收到错误
我正在尝试将handlebars.js 合并到我的SPFx 项目中。我一直在使用以下指南:https: //n8d.at/how-to-use-handlebars-in-sharepoint-framework-projects-spfx/
但是,似乎 webpack 加载器没有被应用,因为我收到了以下错误:
您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件。
我的 gulpfile.js 包含以下代码:
const loaderConfig = {
test: /\.hbs$/,
use: {
loader: "handlebars-loader",
},
};
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
generatedConfiguration.module.rules.push(loaderConfig);
return generatedConfiguration;
},
});
如果您有任何建议,请告诉我。
I'm trying to incorporate handlebars.js in my SPFx project. I've been using the following guide: https://n8d.at/how-to-use-handlebars-in-sharepoint-framework-projects-spfx/
However, it appears as though the webpack loader isn't being applied because I receive the following error:
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
My gulpfile.js contains the following code:
const loaderConfig = {
test: /\.hbs$/,
use: {
loader: "handlebars-loader",
},
};
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
generatedConfiguration.module.rules.push(loaderConfig);
return generatedConfiguration;
},
});
Please let me know if you have any suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我意识到自己的错误。我正在使用 spfx-fast-serve 库,它需要对 webpack 加载器进行额外配置。请参阅此处: https://github.com/s-KaiNet/spfx -fast-serve#webpack-扩展性
I realized my mistake. I am using the spfx-fast-serve library, which requires additional configuration for webpack loaders. See here: https://github.com/s-KaiNet/spfx-fast-serve#webpack-extensibility