Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: Fragment is not defined #809

Closed
frankandrobot opened this issue Feb 26, 2021 · 3 comments
Closed

ReferenceError: Fragment is not defined #809

frankandrobot opened this issue Feb 26, 2021 · 3 comments

Comments

@frankandrobot
Copy link

As per #564, should this have been fixed?

I'm using microbundle 0.13.0

I tried the following build commands to no avail:

  • microbundle --tsconfig tsconfig.son --jsx React.createElement <-- this gives a Fragment is not defined error
  • microbundle --tsconfig tsconfig.json --jsxFragment React.Fragment --jsx React.createElement <-- this gives a React is not defined error
Microbundle 0.13.0
React 17.0.1
Typescript 4.1.3

tsconfig.json:

{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "ESNext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": ["node_modules", "out", "dist"]
}
@frankandrobot
Copy link
Author

  • NVM :-) This appears to be working with microbundle --tsconfig tsconfig.json --jsxFragment React.Fragment --jsx React.createElement
  • the React error was because a component file did not import React. After adding React to the its import, it ran fine

@quantizor
Copy link

@developit can this be added to the documentation? Just ran into the same thing.

@rschristian
Copy link
Collaborator

@probablyup Are you referring to the --jsxFragment flag? I'll get that added soon here.

bors bot pushed a commit that referenced this issue Mar 3, 2022
#809 (comment)

I removed the `options.jsx === 'React.createElement'` thing as it's no longer relevant with `jsxFragmentFactory` (see #623 (comment)) and we set default values in the CLI for both `jsx` and `jsxFragment`, so we don't really need extra fallback values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants