{"id":26314,"library":"resource-compiler","title":"express-resource-compiler","description":"Resource compiler and cacher for Express. Current stable version: 0.2.8. This package allows you to compile and cache resources (e.g., CSS, JavaScript templates) in an Express application. It is designed to be generic and integrate with Express's middleware pattern. The package has seen no recent updates and is in early stages, with limited documentation and community adoption. Differentiators include its focus on resource compilation and caching for Express, as opposed to more general-purpose build tools or asset pipelines. It supports a plugin-like system for custom compilers.","status":"maintenance","version":"0.2.8","language":"javascript","source_language":"en","source_url":"git://github.com/LifeWanted/express-resource-compiler","tags":["javascript","express","resource","resources","resource compiler","compiler","utilities","utility"],"install":[{"cmd":"npm install resource-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add resource-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add resource-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Express integration","package":"express","optional":false}],"imports":[{"note":"Default export; CommonJS require gives the constructor directly (no .default).","wrong":"const ResourceCompiler = require('resource-compiler').default","symbol":"ResourceCompiler","correct":"import ResourceCompiler from 'resource-compiler'"},{"note":"Named export available; CommonJS require works but beware of .compile property.","wrong":"const compile = require('resource-compiler').compile","symbol":"compile","correct":"import { compile } from 'resource-compiler'"},{"note":"TypeScript: use `import type` for type-only imports to avoid runtime impact.","wrong":"import ResourceCompiler from 'resource-compiler'","symbol":"ResourceCompiler (type)","correct":"import type ResourceCompiler from 'resource-compiler'"}],"quickstart":{"code":"const express = require('express');\nconst ResourceCompiler = require('resource-compiler');\n\nconst app = express();\nconst compiler = new ResourceCompiler({\n  cache: true,\n  cacheDir: './cache',\n  compilers: {\n    '.jst': (content, filename) => `module.exports = ${JSON.stringify(content)};`\n  }\n});\n\napp.use(compiler.middleware());\n\napp.get('/', (req, res) => {\n  res.send('Resource compiler active');\n});\n\napp.listen(3000);","lang":"javascript","description":"Basic setup of express-resource-compiler with custom compiler for .jst files and caching enabled."},"warnings":[{"fix":"Always provide a `compilers` configuration with at least one extension handler.","message":"Constructor requires `compilers` object; missing it causes silent failure.","severity":"gotcha","affected_versions":"all"},{"fix":"Set `cacheDir` to a writable path or disable caching (`cache: false`).","message":"Cache directory is created synchronously on instantiation; ensure write permissions.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider migrating to a more maintained alternative like webpack or gulp.","message":"Version 0.2.x is outdated; no updates since 2018.","severity":"deprecated","affected_versions":"0.x"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install resource-compiler` and ensure it's in dependencies.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'resource-compiler'"},{"fix":"Ensure you instantiate with `new ResourceCompiler(options)` and call `middleware()` method.","cause":"Using import incorrectly or object is not a ResourceCompiler instance.","error":"compiler.middleware is not a function"},{"fix":"Use `const ResourceCompiler = require('resource-compiler');` (no `.default`).","cause":"Likely using `require` with a named export instead of default.","error":"TypeError: Cannot read property 'prototype' of undefined (in ResourceCompiler)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}