add jotai/babel/plugin-debug-label on dev server

This commit is contained in:
Sidney Alcantara
2022-04-13 14:02:46 +10:00
parent 07349ac7a0
commit 2c785753a9

View File

@@ -1,3 +1,4 @@
const { whenProd } = require("@craco/craco");
const CracoAlias = require("craco-alias");
const CracoSwcPlugin = require("craco-swc");
@@ -11,20 +12,30 @@ module.exports = {
tsConfigPath: "./tsconfig.extend.json",
},
},
{
plugin: CracoSwcPlugin,
options: {
swcLoaderOptions: {
jsc: {
target: "es2019",
transform: {
react: {
runtime: "automatic",
// Use swc on production only since Jotai doesnt have swc plugins yet
// See https://github.com/pmndrs/jotai/discussions/1057
...whenProd(
() => [
{
plugin: CracoSwcPlugin,
options: {
swcLoaderOptions: {
jsc: {
target: "es2021",
transform: {
react: {
runtime: "automatic",
},
},
},
},
},
},
},
},
],
[]
),
],
babel: {
plugins: ["jotai/babel/plugin-debug-label"],
},
};