Skip to content

Commit

Permalink
βœ…πŸ› Make sure xstyled fonts are transformed and applied in storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
D1no committed Mar 7, 2022
1 parent 3424c35 commit 680d0a0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ module.exports = {
features: {
emotionAlias: false,
},
webpackFinal: async (config, { configType }) => {
const oneOfRule = config.module.rules.find((rule) => rule.oneOf);
const babelRule = oneOfRule.oneOf.find((rule) =>
rule.loader?.includes("babel-loader"),
);

babelRule.options.presets.push("@emotion/babel-preset-css-prop");

return config;
},
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
]
},
"devDependencies": {
"@emotion/babel-preset-css-prop": "^11.2.0",
"@mdx-js/react": "^1.6.22",
"@storybook/addon-actions": "^6.4.19",
"@storybook/addon-docs": "^6.4.19",
Expand Down
32 changes: 29 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-syntax-jsx@npm:^7.12.13, @babel/plugin-syntax-jsx@npm:^7.16.7":
"@babel/plugin-syntax-jsx@npm:^7.12.13, @babel/plugin-syntax-jsx@npm:^7.16.7, @babel/plugin-syntax-jsx@npm:^7.2.0":
version: 7.16.7
resolution: "@babel/plugin-syntax-jsx@npm:7.16.7"
dependencies:
Expand Down Expand Up @@ -1354,7 +1354,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/plugin-transform-react-jsx@npm:^7.12.12":
"@babel/plugin-transform-react-jsx@npm:^7.12.1, @babel/plugin-transform-react-jsx@npm:^7.12.12":
version: 7.17.3
resolution: "@babel/plugin-transform-react-jsx@npm:7.17.3"
dependencies:
Expand Down Expand Up @@ -1881,7 +1881,18 @@ __metadata:
languageName: node
linkType: hard

"@emotion/babel-plugin@npm:^11.7.1":
"@emotion/babel-plugin-jsx-pragmatic@npm:^0.1.5":
version: 0.1.5
resolution: "@emotion/babel-plugin-jsx-pragmatic@npm:0.1.5"
dependencies:
"@babel/plugin-syntax-jsx": ^7.2.0
peerDependencies:
"@babel/core": ^7.0.0
checksum: b92aafafd35eca0cf9690a4b21899827ef24e0ce7bfe97381ef3258113deaa21eb047b492f4eadfac5ba57b301c0bdcab934d776774d91e867f1a8bdb7ab9870
languageName: node
linkType: hard

"@emotion/babel-plugin@npm:^11.2.0, @emotion/babel-plugin@npm:^11.7.1":
version: 11.7.2
resolution: "@emotion/babel-plugin@npm:11.7.2"
dependencies:
Expand All @@ -1903,6 +1914,20 @@ __metadata:
languageName: node
linkType: hard

"@emotion/babel-preset-css-prop@npm:^11.2.0":
version: 11.2.0
resolution: "@emotion/babel-preset-css-prop@npm:11.2.0"
dependencies:
"@babel/plugin-transform-react-jsx": ^7.12.1
"@babel/runtime": ^7.7.2
"@emotion/babel-plugin": ^11.2.0
"@emotion/babel-plugin-jsx-pragmatic": ^0.1.5
peerDependencies:
"@babel/core": ^7.0.0
checksum: 211fb98cb5fb958ddaaeeb326595c4681f0d6a8ac626dec4499cbd1771909f9c6d9af174e6288ef444ad256c0cd96238ab1575a460aeb9be93277b521f891eb3
languageName: node
linkType: hard

"@emotion/cache@npm:^10.0.27":
version: 10.0.29
resolution: "@emotion/cache@npm:10.0.29"
Expand Down Expand Up @@ -8320,6 +8345,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "curriculumvitae@workspace:."
dependencies:
"@emotion/babel-preset-css-prop": ^11.2.0
"@emotion/react": ^11.8.1
"@emotion/styled": ^11.8.1
"@mdx-js/react": ^1.6.22
Expand Down

0 comments on commit 680d0a0

Please sign in to comment.