Skip to content

update for esm #130

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tonisives
Copy link

Motivation

Code editor does not work in vite component libraries or vite-federation

I think this is specific to my frontend, which uses type: "module" and some specific tsconfig options

{
  "compilerOptions": {
    "target": "es2022",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "types": [
      "vite/client"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": [
    "src",
    "src/setupTests.ts"
  ]
}

However, I think this configuration is quite modern, and might be preferrable.

For this tsConfig, and when using code editor in a Component library or a federation remote, the code editor fails with undefined, calling useState error. Eg, it doesn't find React.

Test plan

I tested this PR with federation plugin, and it works.

Note that this is just a quick mockup and can be used as basis for a proper PR.

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

Successfully merging this pull request may close these issues.

1 participant