You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vite works for development vite build works, no errors
vite serve works but when i navigate to the url i get this error
localhost/:1 Uncaught TypeError: Failed to resolve module specifier "react/jsx-runtime". Relative references must start with either "/", "./", or "../".
My vite.config.ts
import reactRefresh from '@vitejs/plugin-react-refresh';
import reactJsx from 'vite-react-jsx';
import { defineConfig } from 'vite';
import path from 'path';
var projectRootDir = path.resolve(__dirname);
var srcDir = path.resolve(projectRootDir, 'src');
var node_modulesDir = path.resolve(projectRootDir, 'node_modules');
var distDir = path.resolve(projectRootDir, 'dist');
var fs = require('fs-extra');
// https://vitejs.dev/config/
export default defineConfig({
server: {
https: true,
},
plugins: [
reactJsx(),
reactRefresh(),
fs.copy(node_modulesDir + '/react/jsx-runtime.js', distDir + '/jsx-runtime.js'),
],
build: {
rollupOptions: {
external: ['react/jsx-runtime'],
}
}
});
Used package manager: yarn
I am trying fs.copy in plugins but the file isnt copied to dist folder.
Someone here had a similar issue (lit-element), so i also tried the fs.copy command in combination with this in index.html.
vite
works for developmentvite build
works, no errorsvite serve
works but when i navigate to the url i get this errorlocalhost/:1 Uncaught TypeError: Failed to resolve module specifier "react/jsx-runtime". Relative references must start with either "/", "./", or "../".
My vite.config.ts
Used package manager: yarn
I am trying fs.copy in plugins but the file isnt copied to dist folder.
Someone here had a similar issue (lit-element), so i also tried the fs.copy command in combination with this in index.html.
Using the importmap affects where is searches for the file so it should work if i could get jsx-runtime.js copied to the dist folder.
The text was updated successfully, but these errors were encountered: