Home > Enterprise >  SPFx webpack loader is defined, but am still receiving error
SPFx webpack loader is defined, but am still receiving error

Time:03-02

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.

CodePudding user response:

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

  • Related