
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
prerender-seo
Advanced tools
Prerender HTML files using Puppeteer.
npm i prerender-seo -D
const path = require('path')
const prerender = require('prerender-seo')
const files = [
'/index.html'
]
prerender(
path.resolve(__dirname, './dist'),
files,
{
// options
}
)
The test case use a vue-cli generated project
npm run test
| Name | Type | Default | Description |
|---|---|---|---|
sourceDir | {String} | - | Source directory of static files |
files | {Array} | - | HTML Files to prerender |
options.destDir | {String} | *_prerender | Destination directory to store the result |
options.proxyTable | {Array} | [] | Proxy to forward any http request that match the config |
options.navigationTimeout | {Number} | 30000 | Define the timeout of any navigation operations |
options.resourceInterception | {Array} | [] | Define the regular expression of any resource will be aborted |
sourceDirprerender(
path.resolve(__dirname, '../dist')
)
filesprerender(
files: [
'index.html',
'about.html',
'product.html'
]
)
options.destDirDefine the destination directory. If you want to replace the source directory, just set the same path as sourceDir.
prerender(
path.resolve(__dirname, '../dist'),
files: [
'index.html',
'about.html',
'product.html'
],
{
destDir: path.resolve(__dirname, '../dist')
}
)
options.proxyTableprerender(
path.resolve(__dirname, '../dist'),
files: [
'index.html',
'about.html',
'product.html'
],
{
proxyTable: {
context: '/api',
proxy: {
host: 'example.com',
port: '80',
protocol: 'http'
}
}
}
)
options.navigationTimeoutDefine the timeout after which any navigation operations will stop trying. (in milli-secs)
prerender(
path.resolve(__dirname, '../dist'),
files: [
'index.html',
'about.html',
'product.html'
],
{
navigationTimeout: 60000
}
)
options.resourceInterceptionDefine the regular expression to match any resource url will be aborted before request. The left hand in the array is RegExp pattern, the right hand is RegExp flag.
prerender(
path.resolve(__dirname, '../dist'),
files: [
'index.html',
'about.html',
'product.html'
],
{
resourceInterception: [
['hm.baidu.com', 'g'],
['/api/tokenAttach', 'g']
]
}
)
FAQs
Prerender Javascript rendered pages
The npm package prerender-seo receives a total of 2 weekly downloads. As such, prerender-seo popularity was classified as not popular.
We found that prerender-seo demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.