feat(react): adds styled-components and emotion plugins for react apps so SSR works correctly. (#2605)

Closes #2119
This commit is contained in:
Jack Hsu 2020-03-04 11:27:22 -05:00 committed by GitHub
parent d37fc66bc7
commit 5cdf3728da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 0 deletions

View File

@ -109,7 +109,9 @@
"axios": "^0.19.0",
"babel-loader": "8.0.6",
"babel-plugin-const-enum": "^0.0.5",
"babel-plugin-emotion": "^10.0.29",
"babel-plugin-macros": "2.6.1",
"babel-plugin-styled-components": "^1.10.7",
"babel-plugin-transform-async-to-promises": "0.8.15",
"browserslist": "4.8.7",
"cacache": "12.0.2",

View File

@ -38,6 +38,8 @@
"@nrwl/web": "*",
"@angular-devkit/schematics": "~9.0.1",
"@svgr/webpack": "^5.2.0",
"babel-plugin-emotion": "^10.0.29",
"babel-plugin-styled-components": "^1.10.7",
"confusing-browser-globals": "^1.0.9",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",

View File

@ -8,5 +8,16 @@ export function updateBabelOptions(options: any): void {
useBuiltIns: true
}
]);
options.plugins.splice(
0,
0,
[
require.resolve('babel-plugin-styled-components'),
{
pure: true
}
],
require.resolve('babel-plugin-emotion')
);
return options;
}

View File

@ -3103,6 +3103,11 @@
resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.4.tgz#f14932887422c9056b15a8d222a9074a7dfa2831"
integrity sha512-fxfMSBMX3tlIbKUdtGKxqB1fyrH6gVrX39Gsv3y8lRYKUqlgDt3UMqQyGnR1bQMa2B8aGnhLZokZgg8vT0Le+A==
"@emotion/hash@0.8.0":
version "0.8.0"
resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.8.0.tgz#bbbff68978fefdbe68ccb533bc8cbe1d1afb5413"
integrity sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==
"@emotion/is-prop-valid@0.8.6", "@emotion/is-prop-valid@^0.8.3":
version "0.8.6"
resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.6.tgz#4757646f0a58e9dec614c47c838e7147d88c263c"
@ -3142,6 +3147,17 @@
"@emotion/utils" "0.11.3"
csstype "^2.5.7"
"@emotion/serialize@^0.11.16":
version "0.11.16"
resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.11.16.tgz#dee05f9e96ad2fb25a5206b6d759b2d1ed3379ad"
integrity sha512-G3J4o8by0VRrO+PFeSc3js2myYNOXVJ3Ya+RGVxnshRYgsvErfAOglKAiy1Eo1vhzxqtUvjCyS5gtewzkmvSSg==
dependencies:
"@emotion/hash" "0.8.0"
"@emotion/memoize" "0.7.4"
"@emotion/unitless" "0.7.5"
"@emotion/utils" "0.11.3"
csstype "^2.5.7"
"@emotion/sheet@0.9.3":
version "0.9.3"
resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.3.tgz#689f135ecf87d3c650ed0c4f5ddcbe579883564a"
@ -6089,6 +6105,22 @@ babel-plugin-emotion@^10.0.22:
find-root "^1.1.0"
source-map "^0.5.7"
babel-plugin-emotion@^10.0.29:
version "10.0.29"
resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.29.tgz#89d8e497091fcd3d10331f097f1471e4cc3f35b4"
integrity sha512-7Jpi1OCxjyz0k163lKtqP+LHMg5z3S6A7vMBfHnF06l2unmtsOmFDzZBpGf0CWo1G4m8UACfVcDJiSiRuu/cSw==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@emotion/hash" "0.8.0"
"@emotion/memoize" "0.7.4"
"@emotion/serialize" "^0.11.16"
babel-plugin-macros "^2.0.0"
babel-plugin-syntax-jsx "^6.18.0"
convert-source-map "^1.5.0"
escape-string-regexp "^1.0.5"
find-root "^1.1.0"
source-map "^0.5.7"
babel-plugin-istanbul@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854"
@ -6242,6 +6274,16 @@ babel-plugin-react-docgen@^4.0.0:
babel-plugin-syntax-jsx "^6.18.0"
lodash "^4.17.11"
babel-plugin-styled-components@^1.10.7:
version "1.10.7"
resolved "https://registry.yarnpkg.com/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.7.tgz#3494e77914e9989b33cc2d7b3b29527a949d635c"
integrity sha512-MBMHGcIA22996n9hZRf/UJLVVgkEOITuR2SvjHLb5dSTUyR4ZRGn+ngITapes36FI3WLxZHfRhkA1ffHxihOrg==
dependencies:
"@babel/helper-annotate-as-pure" "^7.0.0"
"@babel/helper-module-imports" "^7.0.0"
babel-plugin-syntax-jsx "^6.18.0"
lodash "^4.17.11"
babel-plugin-syntax-async-functions@^6.8.0:
version "6.13.0"
resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"