btholt / btholt/complete-intro-to-react-v5

SSR build start image error: SyntaxError: Invalid or unexpected token

Open
#76 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I've been playing around with the `ssr` branch and got some issue when using a image in the `assets` folder and run `npm run start`.

"App.js"
```js
...
import logo from "../src/assets/image-logo.png";
...


Adopt Me!

....
```

Here's the error message
![image](https://user-images.githubusercontent.com/24260608/74209547-1824c380-4c3d-11ea-97ec-f1e6464f838d.png)

It works well if I run `npm run dev`, but doesn't work when I run `npm run start`. I thought that's some babel issue, but couldn't figure it out.

Here's [my branch](https://github.com/MujunZ/complete-intro-to-react-v5/tree/ssr-mj) for more information, the last commit is the change.

Please help. Thanks 🙇‍♀️

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with App.js and the imported image in the assets folder, then compare the npm run dev and npm run start paths on the ssr branch. Reproduce the SyntaxError and inspect how the start build handles that asset; done means npm run start succeeds with the imported image rendered.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.