Skip to content

🐛 BUG: Snowpack can't find /src/index.jsx no matter what I do? #3933

@nimmels

Description

@nimmels

Quick checklist

  • I am using the latest version of Snowpack and all plugins.

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the bug

Man... no idea wth is going on. Keep getting the error:

:~/plasma$ npm run start

> plasma@1.0.0 start
> snowpack dev

[14:33:25] [snowpack] Ready!
[14:33:25] [snowpack] Server started in 55ms.
[14:33:25] [snowpack] Local: http://localhost:8080
[14:33:25] [snowpack] Network: http://192.168.178.76:8080
[14:33:26] [snowpack] [404] Not Found (/src/index.jsx)
⠹ watching for file changes..

I run snowpack init leaving default config, my packages.json looks like so:

{
  "name": "plasma",
  "version": "1.0.0",
  "description": "Converting a vanilla JS app (plasma) into React",
  "main": "index.js",
  "scripts": {
    "start": "snowpack dev",
    "build": "snowpack build",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "author1",
  "license": "UNLICENSED",
  "dependencies": {
    "snowpack": "^3.8.8"
  },
// I tried doing things without the following, but here it's included:
  "snowpack": {
    "entrypoints": [
      "src/index.jsx"
    ]
  }
}

Files for a project titled 'plasma':

~/plasma$ tree -I 'node_modules'
.
├── index.html
├── package.json
├── package-lock.json
├── src
│   ├── App
│   │   ├── App.jsx
│   │   └── index.js
│   └── index.jsx
└── style.css

index.html references index.jsx like so

    <body>
        <div id="root"></div>
        <script type="module" src="./src/index.jsx"></script>
    </body>

(also tried naming it .js instead of .jsx)

index.jsx imports react, react-dom, and App, then renders into dom like so:

import React from 'react';
import ReactDOM from 'react-dom';
import { App } from './App';

ReactDOM.render(<App />, document.getElementById('root'));
App.jsx:
import React from 'react';

export const App = () => {
    return(<>Hello from the app component</>);
};
index.js:
export * from './App';

Looked at the above several times over, and could not find an issue.

Steps to reproduce

  1. get some Debian linux (if it matters - specifically BunsenLabs GNU/Linux 11 (Beryllium))
  2. Follow this video-tutorial which converts a vanilla js project into react, with snowpack, up to minute 12:00. Barebones simple config.

Link to minimal reproducible example (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions