
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
webpack-loader
Advanced tools
In development
Based https://github.com/webpack/webpack/issues/536
HTML is the entry point of web. Why not make it the entry point of our bundle? The key here is to instruct webpack to add JS entry point for all script tag with src attribute.
npm i webpack webpack-loader html-loader
// webpack.config.js
module.exports = {
target: 'node',
entry: {
'index': './index.html',
},
output: {
path: './build',
filename: '[name].html.js',
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'html?attrs=script:src'
},
{
test: /\.js$/,
loader: 'webpack'
}
]
},
// Config for webpack-loader, like a mini webpack.config.js without entry
webpackLoader: {
output: {
path: './build/js',
filename: 'bundle.js'
}
}
};
Run webpack will generate index.html.js and js/bundle.js in build/ directory. You can run below to get the compiled HTML.
node -e "console.log(require('./build/index.js'))" > build/index.html
(We can potentially wrap above step into a separate package.)
Very simple, right? What do you think? Love to hear feedbacks as issue or PR.
FAQs
Loader for JS file entry point
The npm package webpack-loader receives a total of 72 weekly downloads. As such, webpack-loader popularity was classified as not popular.
We found that webpack-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
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.