
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
html-require-loader
Advanced tools
Webpack loader for including requiring other HTML files with a <require> tag.
Webpack loader for including requiring other HTML files with a tag.
Allows for including HTML files like:
<body>
<h1 id="foo"></h1>
<h2 id="bar"></h2>
<require path="baz.html">
<require path="templates/qux.html">
</body>
npm install --save html-require-loader
| Option | Description | Default |
|---|---|---|
| root | Root path to look for templates. | Same path as required HTML file. |
var path = require('path');
module.exports = {
// ...
module: {
rules: [
{
test: /\.html/,
exclude: /(node_modules)/,
use: [
{
loader: 'html-require-loader',
options: {
root: path.resolve(__dirname, 'src')
}
}
]
}
]
}
// ...
}
And your require...
require('./index.html');
And then requiring or including other HTML files.
<body>
<h1 id="foo"></h1>
<h2 id="bar"></h2>
<require path="baz.html"></require>
<require path="templates/qux.html"></require>
</body>
Will be transformed into something like:
<body>
<h1 id="foo"></h1>
<h2 id="bar"></h2>
<!-- <require path="/path/to/baz.html"> -->
<h3 id="baz"></h3>
<!-- </require> -->
<!-- <require path="/path/to/qux.html"> -->
<h4 id="qux"></h4>
<!-- </require> -->
</body>
The HTML comments (require markers) are left in to potentially assist with other loaders for sourcemaps and hot reloading.
FAQs
Webpack loader for including requiring other HTML files with a <require> tag.
We found that html-require-loader 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.