Prember Middleware for Ember CLI Development
raw JSON →prember-middleware is an Ember CLI addon designed to facilitate the testing of pre-rendered Ember applications during local development. It provides an `ember-cli` middleware that correctly serves statically pre-rendered HTML files (e.g., `about/index.html` for the `/about` route) from the `dist` directory when running `ember serve`. This is crucial because `ember serve` typically expects dynamic rendering. The package is currently at version 0.1.0, with its last known update around 2017. Given its low version number and explicit Node.js engine constraints (`6.* || >= 7.*`), it is considered abandoned. While the core `prember` addon is actively maintained (last published July 2024, v6.0.0), `prember-middleware` itself has not seen updates. Its primary differentiator is enabling a development environment that mirrors `prember`'s production output without requiring a separate static file server. It integrates directly into the `ember-cli` build pipeline, leveraging Express middleware.
Common errors
error Error: The `engines.node` in `package.json` is not satisfied. Expected "6.* || >= 7.*" but got "X.Y.Z". ↓
nvm) to switch to a compatible Node.js version (e.g., Node 7.x or 8.x, if available and secure), or consider the addon abandoned and seek an alternative solution. error Error: Cannot GET /your-prember-route ↓
PREMBER=true is set when running ember serve. Verify that your prember configuration in ember-cli-build.js includes the desired URLs and that prember successfully runs during the build process to generate the static files. Warnings
breaking The package requires Node.js versions 6.* or >= 7.*, which are long End-of-Life and unsupported. Running this addon with modern Node.js versions (e.g., Node 18+ or 20+) is highly likely to cause compatibility issues or runtime errors. ↓
gotcha This addon is at version 0.1.0 and has not been updated since 2017. It is effectively abandoned, meaning no further bug fixes, security patches, or compatibility updates for newer Ember CLI or Node.js versions will be provided. ↓
gotcha While `prember-middleware` handles serving pre-rendered files, integrating `prember` itself with Ember's modern build system, Embroider, requires specific explicit configuration in `ember-cli-build.js`. The implicit `postprocessTree` hook often used by older addons like `prember` is not supported by Embroider, potentially leading to pre-rendering issues if not configured correctly. ↓
Install
npm install prember-middleware yarn add prember-middleware pnpm add prember-middleware Quickstart
ember install prember-middleware
# Run your Ember app with prember-middleware enabled
# This tells ember-cli to use the prember output for routes
PREMBER=true ember serve
# Example of prember configuration in ember-cli-build.js (for prember, not prember-middleware itself)
// This configures the actual pre-rendering process
// let app = new EmberApp(defaults, {
// prember: {
// urls: [
// '/',
// '/about',
// '/contact'
// ],
// enabled: true // Ensure prember runs even in development if needed, though usually for production
// }
// });