Fix babel config being loaded by vite

This commit is contained in:
Quentin Gliech
2022-11-14 09:59:47 +01:00
parent 44939d02c3
commit 0341d27a99
3 changed files with 3105 additions and 430 deletions

View File

@@ -12,11 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
/** @type {import('@babel/core').TransformOptions} */
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
["@babel/preset-react", { runtime: "automatic" }],
"@babel/preset-typescript",
],
/** @type {import('@babel/core').ConfigFunction} */
module.exports = (api) => {
// For some reason, `vite-plugin-realy` loads the babel config.
// This ensures we only really do transforms when loaded for Jest
if (api.env("test")) {
return {
plugins: ["relay"],
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
["@babel/preset-react", { runtime: "automatic" }],
"@babel/preset-typescript",
],
};
} else {
return {};
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,7 @@
"@types/relay-runtime": "^14.1.4",
"@vitejs/plugin-react": "^2.2.0",
"autoprefixer": "^10.4.13",
"babel-plugin-relay": "^14.1.0",
"eslint": "^8.27.0",
"eslint-config-prettier": "^8.5.0",
"eslint-config-react-app": "^7.0.1",