naviapps / create-nw-react-app

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

nw-react-scripts: main and node-main ignored #30

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi,

I used yarn create nw-react-app react-nw which created a new project in react-nw. In package.json, I see { ..., "main":"index.html", ...} but after project creation, there is no index.html in the root folder.

I created a main.js file in the root folder and added {..., "node-main":"main.js", ...} to the package.json then started the project via yarn start, but the project still loaded the public/index.html file.

Then I renamed the public folder to public2 and ran yarn start again only the see this error message:

Could not find a required file.
  Name: index.html
  Searched in: /Users/denny/Projects/hub/denny-cc/agas/HomePage/demosetupv1/packages/react-nw/public
# nw-react-scripts start exited with code 1

main and node-main are ignored which is not I expected.

My question is how can I enforce nw-react-script loading from .js file instead of always loading from public/index.html?

caocuongajax commented 3 years ago

File main.js move to "build" folder.