Webpack loader that compiles EJS templates (without frontend dependencies) into reusable JavaScript functions. Current stable version is 3.1.0. Release cadence is irregular; major version bumps (e.g., 3.0.0) added webpack 4 support. Key differentiators: it strips out runtime dependencies, compiles templates to functions, supports HTML minification, and is intended for server-side or build-time template compilation—not for browser-ready templates with the full EJS runtime.
npm install ejs-compiled-loaderVerified import paths — ran on the pinned version, not inferred.
Shows basic webpack configuration and how to import an .ejs template, then render it with data.
Upgrade to webpack 4+ or pin ejs-compiled-loader@2.3.0.
Use module.rules with the use property instead of loaders.
Example: use: 'ejs-compiled-loader?delimiter=?' or specify in options: use: { loader: 'ejs-compiled-loader', options: { delimiter: '?' } }Ensure you call the template function with data: const html = template(data);
Run: npm install ejs
Add a rule for .ejs files in your webpack configuration using ejs-compiled-loader.
Call the imported template with data: const html = template(data);