Skip to content

Commit 04fbad1

Browse files
committed
Fix bugs in emotion and styled-components plugins
1 parent 05bb269 commit 04fbad1

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

src/main/plugins/emotion.ts

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,20 @@ export const emotionPlugin = createPlugin({
2525
setup: {
2626
description: "setting up Emotion",
2727
run: async () => {
28-
await addTypeScriptSupportForTheEmotionCssProp()
28+
/*
29+
* Add TypeScript support for the css-prop as per the Emotion docs: https://emotion.sh/docs/typescript#css-prop
30+
*/
31+
await modifyJsonFile("tsconfig.json", (tsConfig) => ({
32+
...tsConfig,
33+
compilerOptions: {
34+
...toObject(tsConfig["compilerOptions"]),
35+
jsxImportSource: "@emotion/react",
36+
},
37+
}))
2938
},
3039
},
3140
},
32-
swcCompilerOptions: {
41+
compilerOptions: {
3342
emotion: true,
3443
},
3544
} as const)
36-
37-
/**
38-
* Add TypeScript support for the css-prop as per the Emotion docs: https://emotion.sh/docs/typescript#css-prop
39-
*/
40-
const addTypeScriptSupportForTheEmotionCssProp = async () => {
41-
await modifyJsonFile("tsconfig.json", (tsConfig) => ({
42-
...tsConfig,
43-
compilerOptions: {
44-
...toObject(tsConfig["compilerOptions"]),
45-
jsxImportSource: "@emotion/react",
46-
},
47-
}))
48-
}

src/main/plugins/styled-components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const styledComponentsPlugin = createPlugin({
2828
],
2929
},
3030
],
31-
swcCompilerOptions: {
31+
compilerOptions: {
3232
styledComponents: true,
3333
},
3434
} as const)

0 commit comments

Comments
 (0)