-
Notifications
You must be signed in to change notification settings - Fork 69
[vite:load-fallback] 'could not load @emotion/react/jsx-runtime' #40
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
Comments
This partial repro is using comments for the plugin. Could you provide a more complete reproduction that shows an issue with this plugin only (and not |
Thank you for your reply. // vite.config.js
import { resolve } from 'path';
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import vitePluginDts from 'vite-plugin-dts';
import { nodeResolve } from '@rollup/plugin-node-resolve';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react({
jsxImportSsource: "@emotion/react"
}),
tsconfigPaths({
root: './',
projects: ['./tsconfig.json'],
}),
vitePluginDts({
insertTypesEntry: true,
}),
],
build: {
lib: {
entry: resolve(__dirname, 'src/main.ts'),
name: 'MyLib,
fileName: 'my-lib',
},
rollupOptions: {
external: [
"@emotion/react",
"@emotion/styled",
"@types/react",
"@types/react-dom",
"react",
"react-dom",
"typescript",
],
plugins: [nodeResolve({
resolveOnly : [...]
})]
},
},
}); //tsconfig.json
{
"compilerOptions": {
"target": "ES6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"noImplicitAny": true,
"resolveJsonModule": true,
"isolatedModules": true,
"jsxImportSource": "@emotion/react",
"incremental": true,
"strictNullChecks": true,
"noImplicitThis": false,
"allowSyntheticDefaultImports": true,
"noFallthroughCasesInSwitch": true
"baseUrl": "src",
"typeRoots": ["node_modules/@types", "types"],
"jsx": "react-jsx",
},
"include": ["vite.config.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"],
}
|
|
I can't repro there is still too much missing pieces. Can you provide a very small repo to reproduce? See https://antfu.me/posts/why-reproductions-are-required My guess for now is a bad interaction between |
I'll give it a try. I'll be right back! |
Hi. I've solved this problem. As you said, the conflict between 'vite-tsconfig-paths' and other plug-ins ("@rollup/plugin-node-resolve") was the problem! Your plug-in is not at fault. Thank you for your reply, and thank you again for making a good plug-in. Happy New Year! |
Cool that you solved it 🎉 |
hello, I have a problem....
This error occurs when built using vite.
here is my vite.config.js / tsconfig.json / dependencies
I used 'plugin-react-swc-emotion' after seeing this issue #25, but the results did not change...
The text was updated successfully, but these errors were encountered: