Skip to content

Commit

Permalink
feat: set up development environment for emotion
Browse files Browse the repository at this point in the history
  • Loading branch information
warmwhiten committed Jun 5, 2022
1 parent 54466d4 commit 99cbd5e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 20 deletions.
12 changes: 11 additions & 1 deletion packages/common-components/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
Expand All @@ -9,6 +9,16 @@ module.exports = {
core: {
builder: '@storybook/builder-webpack5'
},
typescript: {
check: true
},
features: {
babelModeV7: true
},
babel: (config) => {
config.presets.push(require.resolve('@emotion/babel-preset-css-prop'))
return config
},
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
Expand Down
19 changes: 12 additions & 7 deletions packages/common-components/babel.config.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
{
"presets": [
[
"@babel/preset-react",
{ "runtime": "automatic", "importSource": "@emotion/react" }
],
["@babel/env", { "shippedProposals": true }],

["@babel/preset-typescript", { "onlyRemoveTypeImports": true }]
],
"plugins": [
"@emotion/babel-plugin",
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-react-jsx",
"@emotion"
],
"presets": [
["@babel/env", { "shippedProposals": true }],
[
"@babel/react",
"@babel/plugin-transform-react-jsx",
{ "runtime": "automatic", "importSource": "@emotion/react" }
],
["@babel/typescript", { "onlyRemoveTypeImports": true }]
"react-require"
]
}
16 changes: 16 additions & 0 deletions packages/common-components/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"jsx": "preserve",
"jsxImportSource": "@emotion/react",
"composite": true,
"baseUrl": ".",
"plugins": [
{
"name": "typescript-styled-plugin",
"tags": ["styled", "css"]
}
]
},
"include": ["src/**/*", ".storybook/*", "utils/**/*"]
}
1 change: 1 addition & 0 deletions packages/common-components/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions packages/common-components/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ module.exports = {
}
]
},
externals: {
react: 'React'
},
output: {
filename: 'components.bundle.min.js',
library: 'playgroundComponents',
Expand Down
25 changes: 13 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"allowSyntheticDefaultImports": true,
"moduleResolution": "Node",
"resolveJsonModule": true,
Expand All @@ -15,18 +13,21 @@
"module": "esnext",
"isolatedModules": true
},
/*
"references": [
{
"path": "packages/common-components"
},
{
"path": "packages/common-styles"
},

"references": [
{
"path": "packages/common-components"
},
{
"path": "packages/common-styles"
}

/*
{
"path": "packages/common-utils"
},
],
*/
*/
],

"exclude": ["packages/**/dist/**"]
}

0 comments on commit 99cbd5e

Please sign in to comment.