Pete
Pete

Reputation: 1

SPFx webpack loader is defined, but am still receiving error

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.

Upvotes: 0

Views: 938

Answers (1)

Pete
Pete

Reputation: 1

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

Upvotes: 0

Related Questions