@subbly/swc-plugin-add-element-source
v0.1.8
Published
An SWC plugin to add source code location to JSX elements.
Readme
@subbly/swc-plugin-add-element-source
Automatically add JSX element source information.
<!-- Before -->
<div></div>
<!-- After -->
<div
data-sbly-id="src/components/Component.tsx:16:5"
data-sbly-component-path="src/components/Component.tsx"
data-sbly-component-line="16"
></div>Installation
Install as devDependency with your preferred package manager.
npm i -D @subbly/swc-plugin-add-element-sourceAdd plugin to SWC config. Here is an example how to use the plugin with Next.js
// next.config.ts
const nextConfig: NextConfig = {
experimental: {
swcPlugins: [
// Pass an empty object to satisfy SWC's API schema.
['@subbly/swc-plugin-add-element-source', {}]
]
}
};Configuration
No configuration options.
License
MIT
