Webpack loader that automatically requires AngularJS 1.x templates when templateUrl is encountered in JavaScript files. Version 3.1.2 drops Node.js 8 support. It works alongside ngtemplate-loader and html-loader to preprocess template paths. Key differentiator: eliminates manual require calls for templates by transforming templateUrl strings into require() statements at build time. Supports custom path resolution and variable naming to avoid conflicts. Recommended to run before transpilation. Maintained but mature, with infrequent releases.
npm install auto-ngtemplate-loaderVerified import paths — ran on the pinned version, not inferred.
Configures webpack to auto-require AngularJS templates from templateUrl properties, using ngtemplate-loader and html-loader for processing.
Upgrade to Node.js >=10 or use version 2.x if needed.
Use webpack v2+ and pass options via loader options object.
Place auto-ngtemplate-loader before transpilers like babel-loader in the use array.
Upgrade to version >=2.0.1.
Set the relativeTo option on ngtemplate-loader to a common source directory (e.g., 'src/').
Install ngtemplate-loader: npm install ngtemplate-loader --save-dev, then add it to the module.rules for .html files.
Use the variableName option to set a unique variable name, e.g., { loader: 'auto-ngtemplate-loader', options: { variableName: 'myTemplateVar' } }.Use webpack 4 or check for updates on the package. Consider using a different loader if unsupported.