macaron icon indicating copy to clipboard operation
macaron copied to clipboard

React is not defined

Open zxdstyle opened this issue 1 year ago • 2 comments

{
  "@macaron-css/core": "^1.5.2",
  "@macaron-css/solid": "^1.5.3",
  "solid-js": "^1.8.20"
}
import {render} from "solid-js/web";
import { styled } from "@macaron-css/solid"

const root = document.getElementById('root');
render(()=> <App />, root!)

const Button = styled("button", {
    base: {}
})

function App() {
    return <Button>demo</Button>
}

zxdstyle avatar Aug 09 '24 14:08 zxdstyle

Hey! Are you using the jsx automatic transform of react?

Mokshit06 avatar Aug 09 '24 17:08 Mokshit06

vite.config.ts

import { defineConfig } from 'vite'
import solid from 'vite-plugin-solid'
import { macaronVitePlugin } from '@macaron-css/vite'

export default defineConfig({
    plugins: [solid(), macaronVitePlugin()],
})

tsconfig.json

{
  "compilerOptions": {
    // Enable latest features
    "lib": ["ESNext", "DOM"],
    "target": "ESNext",
    "module": "ESNext",
    "moduleDetection": "force",
    "jsx": "preserve",
    "jsxImportSource": "solid-js",
    "allowJs": true,

    // Bundler mode
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "verbatimModuleSyntax": true,
    "noEmit": true,

    // Best practices
    "strict": true,
    "skipLibCheck": true,
    "noFallthroughCasesInSwitch": true,

    // Some stricter flags (disabled by default)
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noPropertyAccessFromIndexSignature": false
  }
}

zxdstyle avatar Aug 10 '24 11:08 zxdstyle

Hey, sorry missed this! Can you try reordering the plugins in the vite config?

Similar to this https://github.com/macaron-css/macaron/blob/main/examples/solid-start/vite.config.ts

Mokshit06 avatar Aug 14 '24 18:08 Mokshit06

Whoops, I missed this warning too image Thank you!

gtarsia avatar Aug 14 '24 18:08 gtarsia

Oops, I wasn’t paying attention,Thank you!

zxdstyle avatar Aug 15 '24 08:08 zxdstyle