Skip to content

Commit

Permalink
feat: remove @svgr/plugin-jsx from core
Browse files Browse the repository at this point in the history
BREAKING CHANGE: plugin-jsx is no longer included by default in core
  • Loading branch information
gregberge committed Mar 24, 2023
1 parent c74b1ec commit a0f078d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
6 changes: 1 addition & 5 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Use `svgr.sync(code, config, state)` if you would like to use sync version.

### Plugins

By default `@svgr/core` doesn't include `svgo` and `prettier` plugins, if you want them, you have to install them and include them in config.
By default `@svgr/core` doesn't include any plugin, if you want them, you have to install them and include them in config.

```js
svgr(svgCode, {
Expand All @@ -54,7 +54,3 @@ MIT
[package]: https://www.npmjs.com/package/@svgr/core
[license-badge]: https://img.shields.io/npm/l/@svgr/core.svg?style=flat-square
[license]: https://github.com/smooth-code/svgr/blob/master/LICENSE

```
```
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"dependencies": {
"@babel/core": "^7.21.3",
"@svgr/babel-preset": "^6.5.1",
"@svgr/plugin-jsx": "^6.5.1",
"camelcase": "^6.2.0",
"cosmiconfig": "^8.1.3"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/plugins.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ describe('#getPlugins', () => {
expect(getPlugins({}, state)).toEqual(['from-state-plugin'])
})

it('should default to ["@svgr/plugin-jsx"]', () => {
expect(getPlugins({}, {})).toEqual([jsx])
it('should default to []', () => {
expect(getPlugins({}, {})).toEqual([])
})

it('should support caller with "defaultPlugins" in second choice', () => {
expect(getPlugins({}, { caller: {} })).toEqual([jsx])
expect(getPlugins({}, { caller: {} })).toEqual([])
})
})

Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-ignore
import jsx from '@svgr/plugin-jsx'
import { Config } from './config'
import type { State } from './state'

Expand All @@ -9,7 +7,7 @@ export interface Plugin {

export type ConfigPlugin = string | Plugin

const DEFAULT_PLUGINS: Plugin[] = [jsx as any]
const DEFAULT_PLUGINS: Plugin[] = []

export const getPlugins = (
config: Config,
Expand Down

0 comments on commit a0f078d

Please sign in to comment.