mrdotb / mrdotb/live_react

Vitejs Error

Open
#51 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Elixir
Stars
271
Forks
23
Avg merge
5m
Merged PRs (30d)
1

Description

Following all the install instructions (I've checked and re-checked 10 times at least). I get the following error running ....

mix assets.build

build
tsc && vite build

vite v7.1.12 building for production...
transforming...
✓ 11 modules transformed.
✗ Build failed in 113ms
error during build:
[vite]: Rollup failed to resolve import "react" from "/Users/nutheory/code/ex_chemists/deps/live_react/assets/js/live_react/hooks.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
at viteLog (file:///Users/nutheory/code/ex_chemists/assets/node_modules/vite/dist/node/chunks/config.js:33865:57)
at file:///Users/nutheory/code/ex_chemists/assets/node_modules/vite/dist/node/chunks/config.js:33899:73
at onwarn (file:///Users/nutheory/code/ex_chemists/assets/node_modules/@vitejs/plugin-react/dist/index.js:76:7)
at file:///Users/nutheory/code/ex_chemists/assets/node_modules/vite/dist/node/chunks/config.js:33899:28
at onRollupLog (file:///Users/nutheory/code/ex_chemists/assets/node_modules/vite/dist/node/chunks/config.js:33894:63)
at onLog (file:///Users/nutheory/code/ex_chemists/assets/node_modules/vite/dist/node/chunks/config.js:33697:4)
at file:///Users/nutheory/code/ex_chemists/assets/node_modules/rollup/dist/es/shared/node-entry.js:20937:32
at Object.logger [as onLog] (file:///Users/nutheory/code/ex_chemists/assets/node_modules/rollup/dist/es/shared/node-entry.js:22823:9)
at ModuleLoader.handleInvalidResolvedId (file:///Users/nutheory/code/ex_chemists/assets/node_modules/rollup/dist/es/shared/node-entry.js:21567:26)
at file:///Users/nutheory/code/ex_chemists/assets/node_modules/rollup/dist/es/shared/node-entry.js:21525:26
** (exit) 1
(mix 1.18.4) lib/mix/tasks/cmd.ex:74: Mix.Tasks.Cmd.run/1
(mix 1.18.4) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(mix 1.18.4) lib/mix/task.ex:561: Mix.Task.run_alias/6
(mix 1.18.4) lib/mix/cli.ex:107: Mix.CLI.run_task/2
/Users/nutheory/.asdf/installs/elixir/1.18.4-otp-27/bin/mix:2: (file)

... and if i try to run the app in the browser i get a similar vite error except it complains about "import 'react-dom/client'"...

everything looks right in deps and node_modules as far as i can see??? any ideas?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with mix assets.build and inspect the import from deps/live_react/assets/js/live_react/hooks.js, along with the Vite installation under assets/node_modules. Check why react and react-dom/client cannot be resolved; done means the asset build succeeds and the browser no longer reports these Vite import errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, react, vite
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.