bevyengine / bevyengine/bevy

Examples broken on web, pulling in `env` package

Open
#19,225 3 comments 0 reactions 0 assignees View on GitHub
C-Bug O-Web S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

`main` @ `139515278c416b216610c796687c3428f528fbd2`

## \[Optional\] Relevant system information

If you cannot get Bevy to build or run on your machine, please include:

- the Rust version you're using (you can get this by running `cargo --version`)
- Bevy relies on the "latest stable release" of Rust
- nightly should generally work, but there are sometimes regressions: please let us know!
- the operating system or browser used, including its version
- e.g. Windows 10, Ubuntu 18.04, iOS 14

If your bug is rendering-related, copy the adapter info that appears when you run Bevy.

```ignore
`AdapterInfo { name: "NVIDIA GeForce RTX 2070", vendor: 4318, device: 7938, device_type: DiscreteGpu, backend: Vulkan }`
```

You should also consider testing the examples of our upstream dependencies to help isolate any setup-specific issue:

- [`wgpu`](https://github.com/gfx-rs/wgpu) for rendering problems
- [`winit`](https://github.com/rust-windowing/winit) for input and window management
- [`gilrs`](https://docs.rs/gilrs/latest/gilrs/) for gamepad inputs

## What you did

With the [Bevy CLI](https://github.com/TheBevyFlock/bevy_cli) installed, use

```sh
bevy run --example=breakout web
```

on the `bevy` repo.

## What went wrong

Loading forever due to an error, in the browser console I get:

```txt
Uncaught TypeError: The specifier “env” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.
```

## Additional information

The first line of the generated JS is:

```js
import * as __wbg_star0 from 'env';
```

Which looks... wrong. Not sure where it comes from.

Note that this _could_ also be a bug related to the Bevy CLI itself, but it's unlikely as it still works with other projects.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `bevy run --example=breakout web` and inspecting the generated JavaScript, especially its `import * as __wbg_star0 from 'env';` line. Trace where that bare `env` import is introduced and confirm that the web example loads successfully in the browser without the console error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.