swc-plugin-jsx-dom-expressions icon indicating copy to clipboard operation
swc-plugin-jsx-dom-expressions copied to clipboard

Add more information on how to use this on Readme

Open NunoCruzSW opened this issue 1 year ago • 1 comments

I was not able to use with yet. I think I am missing some configuration on the swc loader

NunoCruzSW avatar Nov 07 '24 21:11 NunoCruzSW

I added the following configuration to SWC loader

jsc: {
    parser: {
        syntax: 'typescript',
        tsx: true,
        dynamicImport: true,
        importMeta: true,
        decorators: true
    },
    transform: {
        react: {
            runtime: 'automatic',  
            importSource: 'solid-js/h', // Use Solid’s `jsxImportSource`
            throwIfNamespace: false,
            useBuiltins: true,
        },
    }
},
//target: "es2022",
experimental: {
    plugins: [
        [
            "swc-plugin-jsx-dom-expressions",
            {
                module_name: "solid-js/web",
                built_ins: [
                    "For",
                    "Show",
                    "Switch",
                    "Match",
                    "Suspense",
                    "SuspenseList",
                    "Portal",
                    "Index",
                    "Dynamic",
                    "ErrorBoundary"
                ],
                context_to_custom_elements: true,
                wrap_conditionals: true,
            },

        ],
    ],
},

but it compiles fine but the compiled code is missing something.

NunoCruzSW avatar Nov 08 '24 13:11 NunoCruzSW