1 | import jsx from '@babel/plugin-transform-react-jsx'
|
2 | import pragmatic from '@emotion/babel-plugin-jsx-pragmatic'
|
3 | import emotion from '@emotion/babel-plugin'
|
4 |
|
5 | let pragmaName = '___EmotionJSX'
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export default (
|
13 | api,
|
14 | { pragma, sourceMap, autoLabel, labelFormat, importMap, ...options } = {}
|
15 | ) => {
|
16 | if (options.runtime) {
|
17 | throw new Error(
|
18 | 'The `runtime` option has been removed. If you want to configure `runtime: "automatic"`, replace `@emotion/babel-preset-css-prop` with `@babel/preset-react` and `@emotion/babel-plugin`. You can find out how to configure things properly here: https://emotion.sh/docs/css-prop#babel-preset'
|
19 | )
|
20 | }
|
21 |
|
22 | return {
|
23 | plugins: [
|
24 | [
|
25 | pragmatic,
|
26 | {
|
27 | export: 'jsx',
|
28 | module: '@emotion/react',
|
29 | import: pragmaName
|
30 | }
|
31 | ],
|
32 | [
|
33 | jsx,
|
34 | {
|
35 | pragma: pragmaName,
|
36 | pragmaFrag: 'React.Fragment',
|
37 | ...options
|
38 | }
|
39 | ],
|
40 | [
|
41 | emotion,
|
42 | {
|
43 | sourceMap,
|
44 | autoLabel,
|
45 | labelFormat,
|
46 | cssPropOptimization: true,
|
47 | importMap
|
48 | }
|
49 | ]
|
50 | ]
|
51 | }
|
52 | }
|