mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
* type safe babel config * avoid auth redirect for `_next` * force render default error page on user miconfig * add slash to _next path * use `.some` * add docs * change from localhost * add favicon to public path
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
// @ts-check
|
|
// We aim to have the same support as Next.js
|
|
// https://nextjs.org/docs/getting-started#system-requirements
|
|
// https://nextjs.org/docs/basic-features/supported-browsers-features
|
|
|
|
/** @type {import("@babel/core").ConfigFunction} */
|
|
module.exports = (api) => {
|
|
const isTest = api.env("test")
|
|
if (isTest) {
|
|
return {
|
|
presets: [
|
|
"@babel/preset-env",
|
|
["@babel/preset-react", { runtime: "automatic" }],
|
|
["@babel/preset-typescript", { isTSX: true, allExtensions: true }],
|
|
],
|
|
}
|
|
}
|
|
return {
|
|
presets: [
|
|
["@babel/preset-env", { targets: { node: 12 } }],
|
|
"@babel/preset-typescript",
|
|
],
|
|
plugins: [
|
|
"@babel/plugin-proposal-optional-catch-binding",
|
|
"@babel/plugin-transform-runtime",
|
|
],
|
|
ignore: [
|
|
"../src/**/__tests__/**",
|
|
"../src/adapters.ts",
|
|
"../src/providers/oauth-types.ts",
|
|
],
|
|
comments: false,
|
|
overrides: [
|
|
{
|
|
test: [
|
|
"../src/react/index.tsx",
|
|
"../src/utils/logger.ts",
|
|
"../src/core/errors.ts",
|
|
"../src/client/**",
|
|
],
|
|
presets: [
|
|
["@babel/preset-env", { targets: { ie: 11 } }],
|
|
["@babel/preset-react", { runtime: "automatic" }],
|
|
],
|
|
},
|
|
{
|
|
test: ["../src/core/pages/*.tsx"],
|
|
presets: ["preact"],
|
|
plugins: [
|
|
[
|
|
"jsx-pragmatic",
|
|
{
|
|
module: "preact",
|
|
export: "h",
|
|
import: "h",
|
|
},
|
|
],
|
|
],
|
|
},
|
|
],
|
|
}
|
|
}
|