Convert URL to require or import sytanx in JSX.
Example
In
Out
Installation
npm install --save-dev babel-plugin-transform-jsx-url
Usage
Without options:
"plugins": "transform-jsx-url"
With options:
"plugins":"transform-jsx-url""root": "/src""attrs": "img:src" "img:data-src" "link:href"
Options
root
string
, defaults to ""
.
If a root query parameter is set, however, it will be prepended to the url and then translated.
Example
"root": "/src"
In
Out
attrs
Array
, defaults to ["img:src", "link:href"]
.
You can specify which tag-attribute combination should be processed by this loader. Pass an array or a space-separated list of : combinations.
Example
"attrs": ["img:data-src", "custom:src"]