Skip to content

Mysterious Build Failure When Importing Modal Template in Large Project #180

@Poliklot

Description

@Poliklot

Description

In my closed production project, importing a simple Handlebars template (src/views/components/sections/modals/loaded-modals.hbs) in a JS file causes a build failure with a parsing error. The template is minimal, containing only an empty <div>, and isn’t even used in the code.

The import in src/scripts/app.js:

import tmpl from '../views/components/sections/modals/loaded-modals.hbs';

The error is:

ERROR in ./src/views/components/sections/modals/loaded-modals.hbs 8188:34
Module parse failed: Unexpected token (8188:34)
File was processed with these loaders:
 * ./node_modules/html-bundler-webpack-plugin/src/Loader/index.js
 * ./node_modules/handlebars-loader/index.js
You may need an additional loader to handle the result of these loaders.
|           return template(Object.assign({}, data, context));
|         };
>         module.exports=templateFn;

The lack of specific error details makes it hard to pinpoint the issue. Better logging or error messages would help identify what to investigate in the large project.

Steps to Reproduce

not reproducible in the minimal repository

Expected Behavior

The plugin should handle the import of a simple template without causing build failures, or provide clearer error messages to help diagnose the issue in a large project.

Actual Behavior

Importing the loaded-modals.hbs template causes a build failure with a vague parsing error, and the lack of detailed logging makes debugging difficult.

Additional Context

Since this issue only occurs in my closed production repository, I can’t share the full project directly. Creating a sanitized version of the project would be very time-consuming. Could you suggest what specific information I could provide (e.g., Webpack config details, dependency list, or debug logs) to help diagnose the issue? Alternatively, are there ways to enable more detailed logging in the plugin to pinpoint the problem? I’m happy to share any relevant details or test fixes.

Thanks for your continued support! 🙌 I’m happy to provide more details or test any fixes. 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions