
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.
nextjs-tagger
Advanced tools
A lightweight Babel plugin that automatically adds debug attributes to HTML elements in Next.js projects for easier AI-assisted development
A lightweight plugin that automatically adds debug attributes to HTML elements in Next.js projects for easier AI-assisted development.
Perfect for AI coding assistants, code navigation, and debugging! When you click on an element in the browser, you can quickly tell an AI exactly which file and line to modify.
data-wb-id="file:line:column" to HTML elementsoutput: 'export'npm install --save-dev nextjs-tagger
or
yarn add -D nextjs-tagger
or
pnpm add -D nextjs-tagger
1. Update your next.config.js:
const withNextjsTagger = require("nextjs-tagger/next");
/** @type {import('next').NextConfig} */
const nextConfig = {
// Your existing config...
};
module.exports = withNextjsTagger({
enabled: true,
prefixName: "wb",
debug: false,
})(nextConfig);
2. Restart your development server
3. Works with both standard mode and Turbopack:
# Standard mode
npm run dev
# Turbopack mode (also supported)
npm run dev -- --turbopack
1. Create or update .babelrc.js:
module.exports = {
presets: ["next/babel"],
plugins: [
[
"nextjs-tagger",
{
enabled: process.env.NODE_ENV === "development",
prefixName: "wb",
debug: false,
},
],
],
};
2. Restart your development server
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | process.env.NODE_ENV === 'development' | Whether to enable the plugin |
prefixName | string | 'wb' | Prefix for the debug attribute (will become data-{prefixName}-id) |
debug | boolean | false | Enable debug logging |
include | string[] | ['.tsx', '.jsx'] | File extensions to process |
exclude | string[] or RegExp[] | ['node_modules'] | File patterns or paths to exclude from processing |
Once installed, you can easily communicate with AI assistants:
🧑 "I want to modify the button at data-wb-id='components/Header.tsx:17:6'"
🤖 "I'll help you modify the button in components/Header.tsx at line 17, column 6"
The AI can instantly locate the exact file and position to make changes!
Before (original JSX):
export default function HomePage() {
return (
<div className='container'>
<h1>Welcome to my site</h1>
<button onClick={handleClick}>Click me</button>
</div>
);
}
After (with nextjs-tagger in development):
export default function HomePage() {
return (
<div className='container' data-wb-id='pages/index.tsx:3:4'>
<h1 data-wb-id='pages/index.tsx:4:6'>Welcome to my site</h1>
<button onClick={handleClick} data-wb-id='pages/index.tsx:5:6'>
Click me
</button>
</div>
);
}
const withNextjsTagger = require("nextjs-tagger/next");
module.exports = withNextjsTagger({
enabled: process.env.NODE_ENV === "development",
prefixName: "wb",
debug: process.env.NODE_ENV === "development",
})(nextConfig);
module.exports = {
presets: ["next/babel"],
plugins: [
[
"nextjs-tagger",
{
enabled: ["development", "staging"].includes(process.env.NODE_ENV),
prefixName: "wb",
debug: process.env.NODE_ENV === "development",
},
],
],
};
✅ Tagged (HTML elements):
<div>, <span>, <button>, <input>, etc.❌ Not Tagged:
<MyComponent>)<> or <React.Fragment>)node_modulesNext.js Plugin:
next.config.js configurationBabel Plugin:
.babelrc.js exists in project rootdebug: trueThe plugin now fully supports Next.js Turbopack mode! You can use it with or without the --turbopack flag:
# ✅ Both work now
next dev --turbopack
next dev
How it works: The plugin automatically detects and configures both webpack and Turbopack bundlers, ensuring seamless compatibility across all Next.js build modes.
// Add to your global.d.ts or env.d.ts
declare namespace JSX {
interface HTMLAttributes<T> {
"data-wb-id"?: string;
}
}
// Will generate: custom-debug-id="file:line:col"
const withNextjsTagger = require("nextjs-tagger/next");
module.exports = withNextjsTagger({
prefixName: "custom-debug",
})(nextConfig);
const withNextjsTagger = require("nextjs-tagger/next");
const isDev = process.env.NODE_ENV === "development";
const isStaging = process.env.NODE_ENV === "staging";
module.exports = withNextjsTagger({
enabled: isDev || isStaging,
prefixName: isDev ? "dev" : "staging",
debug: isDev,
})(nextConfig);
const withNextjsTagger = require("nextjs-tagger/next");
module.exports = withNextjsTagger({
enabled: true,
prefixName: "wb",
exclude: [
/node_modules/, // RegExp pattern
],
})(nextConfig);
// next.config.js
const withNextjsTagger = require("nextjs-tagger/next");
module.exports = withNextjsTagger({
enabled: true,
prefixName: "wb",
})({
output: "export",
trailingSlash: true,
images: {
unoptimized: true,
},
});
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)MIT © KanChaiShaoXia
Happy coding with AI! 🤖✨
FAQs
A lightweight Babel plugin that automatically adds debug attributes to HTML elements in Next.js projects for easier AI-assisted development
The npm package nextjs-tagger receives a total of 0 weekly downloads. As such, nextjs-tagger popularity was classified as not popular.
We found that nextjs-tagger demonstrated a healthy version release cadence and project activity because the last version was released less than 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.