0.1.4 • Published 2 months ago
@subbly/swc-plugin-add-element-source v0.1.4
@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-source
Add 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