Skip to content
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

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

Open
1 task done
nimmels opened this issue Mar 4, 2023 · 1 comment
Open
1 task done

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

nimmels opened this issue Mar 4, 2023 · 1 comment

Comments

@nimmels
Copy link

nimmels commented Mar 4, 2023

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

> [email protected] 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

@npiyush97
Copy link

npiyush97 commented Mar 27, 2023

you don't have react and react-dom as dependencies.
and can you provide codesandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants