Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code splitting issue #7943

Merged
merged 4 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"unist-util-visit-parents": "^2.1.2"
},
"devDependencies": {
"@netlify/functions": "^1.0.0",
"@netlify/functions": "^1.2.0",
"@types/browser-lang": "^0.1.0",
"@types/github-slugger": "^1.3.0",
"@types/luxon": "^2.3.2",
Expand All @@ -85,7 +85,7 @@
"@types/react-dom": "^18.0.6",
"@types/react-instantsearch-core": "^6.26.2",
"@types/styled-system": "^5.1.15",
"babel-preset-gatsby": "^2.14.0",
"babel-preset-gatsby": "^2.23.0",
"github-slugger": "^1.3.0",
"gray-matter": "^4.0.3",
"husky": "^4.2.5",
Expand All @@ -98,7 +98,7 @@
},
"scripts": {
"build": "gatsby build",
"build:lambda": "netlify-lambda build src/lambda",
"build:lambda": "netlify-lambda build src/lambda --config=./webpack.lambda.js",
"build:10gb": "NODE_OPTIONS=--max-old-space-size=10240 gatsby build",
"clean": "gatsby clean",
"crowdin-clean": "rm -rf .crowdin && mkdir .crowdin",
Expand Down
15 changes: 11 additions & 4 deletions src/@chakra-ui/gatsby-plugin/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
export * from "./Link"
export * from "./Button"
export * from "./Tag"
export * from "./Modal"
import { Button } from "./Button"
import { Link } from "./Link"
import { Tag } from "./Tag"
import { Modal } from "./Modal"

export default {
Button,
Link,
Tag,
Modal,
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This took me a very long time to detect 😆 hate these kind of issues.

Once I removed the .babelrc for some reason these exports stop working as I was expecting. I had to export these in a more manual way, with the expected structure.

2 changes: 1 addition & 1 deletion src/@chakra-ui/gatsby-plugin/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import styles from "./styles"
import foundations from "./foundations"

// Component style overrides
import * as components from "./components"
import components from "./components"

import semanticTokens from "./semanticTokens"

Expand Down
29 changes: 29 additions & 0 deletions webpack.lambda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Expose a custom webpack config in order to let netlify-lambda read it and
// build the TS lambda functions. This way, netlify-lambda use the same
// babel config that Gatsby does.
module.exports = {
module: {
rules: [
{
test: /\.(m?js|ts)?$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: [
"@babel/preset-typescript",
[
"babel-preset-gatsby",
{
targets: {
browsers: [">0.25%", "not dead"],
},
},
],
],
},
},
},
],
},
}
124 changes: 35 additions & 89 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3919,10 +3919,10 @@
hey-listen "^1.0.8"
tslib "^2.3.1"

"@netlify/functions@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@netlify/functions/-/functions-1.0.0.tgz#5b6c02fafc567033c93b15a080cc021e5f10f254"
integrity sha512-7fnJv3vr8uyyyOYPChwoec6MjzsCw1CoRUO2DhQ1BD6bOyJRlD4DUaOOGlMILB2LCT8P24p5LexEGx8AJb7xdA==
"@netlify/functions@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@netlify/functions/-/functions-1.2.0.tgz#0acce06db94113d2a42253930c45cb69ab97c530"
integrity sha512-zCOJPoZQLv4ISHjyBS7asqzR6Y9NU+Vb0VKYDD0xUwYmReMhLTDchjGMkt5x0Jk1EVnJwUvA29rGyQEj3tIgAA==
dependencies:
is-promise "^4.0.0"

Expand Down Expand Up @@ -5886,10 +5886,10 @@ babel-preset-fbjs@^3.4.0:
"@babel/plugin-transform-template-literals" "^7.0.0"
babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0"

babel-preset-gatsby@^2.14.0:
version "2.14.0"
resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.14.0.tgz#233b9de6ce8393e645914147c6a9624cb9b7d0f2"
integrity sha512-IqPgd15jJfJvqvX0i78JwLT48ctb7MdIEqHeKOuo4N8qWmyRIY8xX1IVhhSfDZ3eq62j0rVoqzT7ACUWctikmw==
babel-preset-gatsby@^2.21.0:
version "2.21.0"
resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.21.0.tgz#14d431680d315c5cb62f76aa00ddef271a8b095e"
integrity sha512-L47zbDtFoCr2/vk/Z8Y+qTJW1CfzaWimXekN2cIr0G7Gp2JKqSe85m0aQ2417wkLZxYuAWtzHImTxUPGxA5FoA==
dependencies:
"@babel/plugin-proposal-class-properties" "^7.14.0"
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5"
Expand All @@ -5904,13 +5904,13 @@ babel-preset-gatsby@^2.14.0:
babel-plugin-dynamic-import-node "^2.3.3"
babel-plugin-macros "^3.1.0"
babel-plugin-transform-react-remove-prop-types "^0.4.24"
gatsby-core-utils "^3.14.0"
gatsby-legacy-polyfills "^2.14.0"
gatsby-core-utils "^3.21.0"
gatsby-legacy-polyfills "^2.21.0"

babel-preset-gatsby@^2.21.0:
version "2.21.0"
resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.21.0.tgz#14d431680d315c5cb62f76aa00ddef271a8b095e"
integrity sha512-L47zbDtFoCr2/vk/Z8Y+qTJW1CfzaWimXekN2cIr0G7Gp2JKqSe85m0aQ2417wkLZxYuAWtzHImTxUPGxA5FoA==
babel-preset-gatsby@^2.23.0:
version "2.23.0"
resolved "https://registry.yarnpkg.com/babel-preset-gatsby/-/babel-preset-gatsby-2.23.0.tgz#47482f6a9917455d3e9e0e5ce48c49b44d6d000d"
integrity sha512-Mo5Dnrox1d/rJq8cJ2mv1+SNASVmpB+3LMiQKIGky5B1jCMhNtUoMPmJh2Pq29be8dwngL/GG853YFfZn9U62A==
dependencies:
"@babel/plugin-proposal-class-properties" "^7.14.0"
"@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5"
Expand All @@ -5925,8 +5925,8 @@ babel-preset-gatsby@^2.21.0:
babel-plugin-dynamic-import-node "^2.3.3"
babel-plugin-macros "^3.1.0"
babel-plugin-transform-react-remove-prop-types "^0.4.24"
gatsby-core-utils "^3.21.0"
gatsby-legacy-polyfills "^2.21.0"
gatsby-core-utils "^3.23.0"
gatsby-legacy-polyfills "^2.23.0"

backo2@^1.0.2, backo2@~1.0.2:
version "1.0.2"
Expand Down Expand Up @@ -9392,31 +9392,31 @@ gatsby-core-utils@^2.2.0:
tmp "^0.2.1"
xdg-basedir "^4.0.0"

gatsby-core-utils@^3.14.0:
version "3.15.0"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-3.15.0.tgz#1fb6611765250c187dd6d36c2812a5b0c50204ae"
integrity sha512-aLNrH3gGUIeD9XGk3z/27N5qaVx7y3AAgs/Vu6PJm69t25kTwuOHKNzhlnHkIZypznZkkVeN7QbHBkIKam/ZIQ==
gatsby-core-utils@^3.20.0, gatsby-core-utils@^3.21.0, gatsby-core-utils@^3.5.2:
version "3.21.0"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-3.21.0.tgz#5ca118857cf9f59b69f06f2ae886d8182af46515"
integrity sha512-pCDa9EGU8niRJQVv7ow3ijzmG0PegZaBc5Yt6z4enc4m7Dl5ZT6Edkcw9p8q/FhGiZUkzQhWaRDxUvtaoPwAOQ==
dependencies:
"@babel/runtime" "^7.15.4"
ci-info "2.0.0"
configstore "^5.0.1"
fastq "^1.13.0"
file-type "^16.5.3"
fs-extra "^10.1.0"
got "^11.8.3"
got "^11.8.5"
import-from "^4.0.0"
lmdb "2.3.10"
lmdb "2.5.3"
lock "^1.1.0"
node-object-hash "^2.3.10"
proper-lockfile "^4.1.2"
resolve-from "^5.0.0"
tmp "^0.2.1"
xdg-basedir "^4.0.0"

gatsby-core-utils@^3.20.0, gatsby-core-utils@^3.21.0, gatsby-core-utils@^3.5.2:
version "3.21.0"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-3.21.0.tgz#5ca118857cf9f59b69f06f2ae886d8182af46515"
integrity sha512-pCDa9EGU8niRJQVv7ow3ijzmG0PegZaBc5Yt6z4enc4m7Dl5ZT6Edkcw9p8q/FhGiZUkzQhWaRDxUvtaoPwAOQ==
gatsby-core-utils@^3.23.0:
version "3.23.0"
resolved "https://registry.yarnpkg.com/gatsby-core-utils/-/gatsby-core-utils-3.23.0.tgz#0c8879ffb655f2d8cfe485f03beed7db6441dc69"
integrity sha512-ABVTAkjZh+2H4u6GZ+r1uZrdcWuT5KG2nEpKmBWBp21GWEE+yvUqtGOocBgUeGac1A3ggvn02UzcE6BIEm9PYg==
dependencies:
"@babel/runtime" "^7.15.4"
ci-info "2.0.0"
Expand All @@ -9441,14 +9441,6 @@ gatsby-graphiql-explorer@^2.21.0:
dependencies:
"@babel/runtime" "^7.15.4"

gatsby-legacy-polyfills@^2.14.0:
version "2.14.0"
resolved "https://registry.yarnpkg.com/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-2.14.0.tgz#83e8fa3b395e5e75ee8e094275ee759ae7d570bd"
integrity sha512-OcJrY9eqiHtU8bi1zOiaO+wXZv+W/HOR0oP+5IvmWBIiLl4M+ln/z6PJcqk2fnfIK51zyzARvhPXAakDs5JE4w==
dependencies:
"@babel/runtime" "^7.15.4"
core-js-compat "3.9.0"

gatsby-legacy-polyfills@^2.21.0:
version "2.21.0"
resolved "https://registry.yarnpkg.com/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-2.21.0.tgz#f3a387c72c2f9bd5b8fc406a0c879603fa0d4b5e"
Expand All @@ -9457,6 +9449,14 @@ gatsby-legacy-polyfills@^2.21.0:
"@babel/runtime" "^7.15.4"
core-js-compat "3.9.0"

gatsby-legacy-polyfills@^2.23.0:
version "2.23.0"
resolved "https://registry.yarnpkg.com/gatsby-legacy-polyfills/-/gatsby-legacy-polyfills-2.23.0.tgz#f527aea9d90932ad7f1ef7fd0a6aa260a1abb48a"
integrity sha512-DQexce/ezAU47bd5X5JnwIBdvr7MAJsRXzV3bhWuQhslkWJOp0l6O3EQ148s8Ezu6g66JOre5iKvSvor6qvU6Q==
dependencies:
"@babel/runtime" "^7.15.4"
core-js-compat "3.9.0"

gatsby-link@^4.21.0:
version "4.21.0"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-4.21.0.tgz#da2c8b7e9bd49ad52fe9d9b9d9521eac5d25f81e"
Expand Down Expand Up @@ -10318,7 +10318,7 @@ good-listener@^1.2.2:
dependencies:
delegate "^3.1.2"

got@^11.8.2, got@^11.8.3:
got@^11.8.2:
version "11.8.3"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.3.tgz#f496c8fdda5d729a90b4905d2b07dbd148170770"
integrity sha512-7gtQ5KiPh1RtGS9/Jbv1ofDpBFuq42gyfEib+ejaRBJuj/3tQFeR5+gw57e4ipaU8c/rCjvX6fkQz2lyDlGAOg==
Expand Down Expand Up @@ -11905,55 +11905,6 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==

lmdb-darwin-arm64@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-darwin-arm64/-/lmdb-darwin-arm64-2.3.10.tgz#4e20f75770eeedc60af3d4630975fd105a89ffe8"
integrity sha512-LVXbH2MYu7/ZuQ8+P9rv+SwNyBKltxo7vHAGJS94HWyfwnCbKEYER9PImBvNBwzvgtaYk6x0RMX3oor6e6KdDQ==

lmdb-darwin-x64@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-darwin-x64/-/lmdb-darwin-x64-2.3.10.tgz#e53637a6735488eaa15feb7c0e9da142015b9476"
integrity sha512-gAc/1b/FZOb9yVOT+o0huA+hdW82oxLo5r22dFTLoRUFG1JMzxdTjmnW6ONVOHdqC9a5bt3vBCEY3jmXNqV26A==

lmdb-linux-arm64@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-linux-arm64/-/lmdb-linux-arm64-2.3.10.tgz#ac7db8bdfe0e9dbf2be1cc3362d6f2b79e2a9722"
integrity sha512-Ihr8mdICTK3jA4GXHxrXGK2oekn0mY6zuDSXQDNtyRSH19j3D2Y04A7SEI9S0EP/t5sjKSudYgZbiHDxRCsI5A==

lmdb-linux-arm@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-linux-arm/-/lmdb-linux-arm-2.3.10.tgz#74235418bbe7bf41e8ea5c9d52365c4ff5ca4b49"
integrity sha512-Rb8+4JjsThuEcJ7GLLwFkCFnoiwv/3hAAbELWITz70buQFF+dCZvCWWgEgmDTxwn5r+wIkdUjmFv4dqqiKQFmQ==

lmdb-linux-x64@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-linux-x64/-/lmdb-linux-x64-2.3.10.tgz#d790b95061d03c5c99a57b3ad5126f7723c60a2f"
integrity sha512-E3l3pDiCA9uvnLf+t3qkmBGRO01dp1EHD0x0g0iRnfpAhV7wYbayJGfG93BUt22Tj3fnq4HDo4dQ6ZWaDI1nuw==

lmdb-win32-x64@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb-win32-x64/-/lmdb-win32-x64-2.3.10.tgz#bff73d12d94084343c569b16069d8d38626eb2d6"
integrity sha512-gspWk34tDANhjn+brdqZstJMptGiwj4qFNVg0Zey9ds+BUlif+Lgf5szrfOVzZ8gVRkk1Lgbz7i78+V7YK7SCA==

lmdb@2.3.10:
version "2.3.10"
resolved "https://registry.yarnpkg.com/lmdb/-/lmdb-2.3.10.tgz#640fc60815846babcbe088d7f8ed0a51da857f6a"
integrity sha512-GtH+nStn9V59CfYeQ5ddx6YTfuFCmu86UJojIjJAweG+/Fm0PDknuk3ovgYDtY/foMeMdZa8/P7oSljW/d5UPw==
dependencies:
msgpackr "^1.5.4"
nan "^2.14.2"
node-addon-api "^4.3.0"
node-gyp-build-optional-packages "^4.3.2"
ordered-binary "^1.2.4"
weak-lru-cache "^1.2.2"
optionalDependencies:
lmdb-darwin-arm64 "2.3.10"
lmdb-darwin-x64 "2.3.10"
lmdb-linux-arm "2.3.10"
lmdb-linux-arm64 "2.3.10"
lmdb-linux-x64 "2.3.10"
lmdb-win32-x64 "2.3.10"

lmdb@2.5.2:
version "2.5.2"
resolved "https://registry.yarnpkg.com/lmdb/-/lmdb-2.5.2.tgz#37e28a9fb43405f4dc48c44cec0e13a14c4a6ff1"
Expand Down Expand Up @@ -13069,11 +13020,6 @@ node-gyp-build-optional-packages@5.0.3:
resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.3.tgz#92a89d400352c44ad3975010368072b41ad66c17"
integrity sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA==

node-gyp-build-optional-packages@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-4.3.2.tgz#82de9bdf9b1ad042457533afb2f67469dc2264bb"
integrity sha512-P5Ep3ISdmwcCkZIaBaQamQtWAG0facC89phWZgi5Z3hBU//J6S48OIvyZWSPPf6yQMklLZiqoosWAZUj7N+esA==

node-gyp-build@^4.2.3:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.3.0.tgz#9f256b03e5826150be39c764bf51e993946d71a3"
Expand Down