naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

Public path #14

Closed bcarroll22 closed 6 years ago

bcarroll22 commented 6 years ago

Hello, great work on this package!

It looks like the public path options don't work, is this something that's expected or is there something I'm missing? I'm looking to put images in the public folder and then be able to access them by using absolute paths. Will this work using this package?

Thanks!

naviapis commented 6 years ago

Fixed it.

Please update nw-react-scripts library,

package.json

{
  "dependencies": {
-    "nw-react-scripts": "^1.0.10"
+    "nw-react-scripts": "^1.0.11"
  }
}

Run yarn or npm update command.

Example

Folder structure

/public
  /images
    /example.png
/src
  /App.js

JSX

<img src={process.env.PUBLIC_URL + '/images/example.png'} />
  or
<img src={`${process.env.PUBLIC_URL}/images/example.png`} />

Thanks for the report.