
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.
Let's take w-popover for example.
/* filename: pack.js */
const { default: pack } = require('packw');
const argv = require('yargs').argv;
const path = require('path');
const isBuild = !!argv.build;
pack(!isBuild, {
entry: {
index: `./demo/index`,
},
output: {
path: path.resolve(__dirname, !isBuild ? '.dev' : 'docs'),
publicPath: '',
},
devServer: {
port: 9101,
},
resolve: {
alias: {
'w-popover': path.resolve(__dirname, './src'),
},
},
});
/* filename: index.ssr.jsx */
import React from 'react';
import { renderToString } from 'react-dom/server';
import App from './App';
export default function () {
return renderToString(<App />);
}
// filename: pack.ssr.js
const { getNodeLib } = require('packw');
const chalk = require('chalk');
getNodeLib({ index: './demo/index.ssr.jsx' }, () => {
console.log(chalk.greenBright('ssr library generated!'));
});
// filename: index.tpl.js in root directory.
const path = require('path');
const fs = require('fs');
module.exports = function (htmlWebpackPlugin) {
let renderer = {};
if (fs.existsSync(path.resolve(`./ssr-lib/index.js`))) {
renderer = require(`./ssr-lib/index.js`).default;
}
const body = renderer?.();
return `
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="format-detection" content="telephone=no, email=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
${htmlWebpackPlugin.tags.headTags}
<link rel="shortcut icon" />
<title>w-popover demo</title>
</head>
<body>
<div id="root">${body}</div>
${htmlWebpackPlugin.tags.bodyTags}
</body>
</html>
`;
};
node pack.ssr && node pack --build
just like prerender, except for that we run the ssr function for each request. below is an example with express.js
const express = require('express');
const app = express();
const path = require('path');
const ssrRenderer = require('./ssr-lib/index');
app.disable('x-powered-by');
app.enable('trust proxy');
app.set('view engine', 'html');
app.engine('html', require('ejs').renderFile);
app.set('views', path.resolve(__dirname, 'dist'));
const distRoot = path.resolve(__dirname, 'dist');
app.use(express.static(distRoot));
app.use((req, res, next) => {
const context = {};
res.render(
'index',
{ html: ssrRenderer.indexRender(req.url, context), delimiter: '?' },
(err, str) => {
if (err) {
throw err;
}
res.send(str);
}
);
});
app.use(function (err, req, res, next) {
if (err) {
res.status(500).send('server is down.');
}
});
const PORT = process.env.PORT || 8080;
app.listen(PORT, () => {
console.info(`==> 🍺 Express server running at localhost: ${PORT}`);
});
FAQs
Webpack5 out-of-the-box dx for react project.
We found that packw 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.