Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
@svgr/plugin-jsx
Transforms SVG into JSX.
Install
npm install --save-dev @svgr/plugin-jsx
Usage
.svgrrc
{
"plugins": ["@svgr/plugin-jsx"]
}
How does it work?
@svgr/plugin-jsx consists in three phases:
- Parsing the SVG code using svg-parser
- Converting the HAST into a Babel AST
- Applying
@svgr/babel-presettransformations
Applying custom transformations
You can extend the Babel config applied in this plugin using jsx.babelConfig config path:
// .svgrrc.js
module.exports = {
jsx: {
babelConfig: {
plugins: [
// For an example, this plugin will remove "id" attribute from "svg" tag
[
'@svgr/babel-plugin-remove-jsx-attribute',
{
elements: ['svg'],
attributes: ['id'],
},
],
],
},
},
}
Several Babel plugins are available:
@svgr/babel-plugin-add-jsx-attribute@svgr/babel-plugin-remove-jsx-attribute@svgr/babel-plugin-remove-jsx-empty-expression@svgr/babel-plugin-replace-jsx-attribute-value@svgr/babel-plugin-svg-dynamic-title@svgr/babel-plugin-svg-em-dimensions@svgr/babel-plugin-transform-react-native-svg@svgr/babel-plugin-transform-svg-component
If you want to create your own, reading Babel Handbook is a good start!
License
MIT