{"library":"prerender-loader","title":"prerender-loader","description":"Webpack loader for prerendering single-page applications at build time, providing static HTML to improve First Contentful Paint (FCP) and SEO. Current stable version is 1.3.0, with initial release in 2019 and intermittent minor updates. Unlike SSR frameworks that require a server, prerender-loader works entirely within the Webpack build pipeline, integrates seamlessly with html-webpack-plugin, supports both DOM and string prerendering, and runs under Node.js with JSDOM. It is maintained by Google Chrome Labs.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install prerender-loader"],"cli":null},"imports":["import html from 'prerender-loader?!./index.html';","module.exports = { module: { rules: [ { test: /\\.html$/, loader: 'prerender-loader?string' } ] } }","new HtmlWebpackPlugin({ template: '!!prerender-loader?string!index.html' })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npm install --save-dev prerender-loader webpack memory-fs\n\n// webpack.config.js\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: { filename: 'bundle.js' },\n  plugins: [\n    new HtmlWebpackPlugin({\n      template: '!!prerender-loader?string!index.html'\n    })\n  ]\n};\n\n// index.html (example)\n<!DOCTYPE html>\n<html>\n<head><title>My App</title></head>\n<body><div id=\"root\"></div></body>\n</html>\n\n// src/index.js (example)\ndocument.getElementById('root').innerHTML = '<h1>Hello</h1>';\n\n// Run: npx webpack --mode production","lang":"javascript","description":"Installs prerender-loader and integrates with HtmlWebpackPlugin to prerender a simple app that modifies the DOM.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}