milomg / swc-plugin-jsx-dom-expressions

An SWC implementation of the SolidJS Dom Expressions compiler
56 stars 8 forks source link

Add more information on how to use this on Readme #20

Open NunoCruzSW opened 2 weeks ago

NunoCruzSW commented 2 weeks ago

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

NunoCruzSW commented 2 weeks ago

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.