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

Production version not working #2

Open
ghost opened this issue Sep 4, 2017 · 4 comments
Open

Production version not working #2

ghost opened this issue Sep 4, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Sep 4, 2017

I did a clean clone of the repo, installed packages, then ran npm run dist.
When I open the webpage I get an error: Not allowed to load local resource: .../ElectronNext.app/Contents/Resources/app.asar/renderer/out/start/index.html

To fix this, i disabled web security on the mainBrowser window:

const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      webSecurity: false
    }
})

The error is gone, but now the app loads a blank screen.

What might be the problem?

@ghost
Copy link
Author

ghost commented Sep 4, 2017

I've spotted a couple of problems so far:

  1. You can't have await running in production app. It has to be done on with dev: isDev? await() : '';
  2. The index.html file generated by next export has references to /_next which, on production app, will point to file:///_next which obviously doesn't exist. All references must have the first / removed from them.
  3. The _next folder also needs to be under the start folder.

The first one is trivial to solve.
The second and third have to be fixed manually everytime a new build is made. I'm not sure yet how to proceed next to make it automatic.

@Tzelon
Copy link

Tzelon commented Apr 13, 2018

Just tried to build for production. everything seems to be working.

@realtebo
Copy link

realtebo commented Nov 1, 2018

Hi !

I can confirm issues with your boilerblate

I am on windows 10 pro, with node 10 and npm 6

npm install is running fine

Also npm start works well, and hot reloading is marveillous when seen working inside an electron app !

But when running npm run dist I got an error, because bundle is not a valid command

E:\next_js\electron-next-skeleton>npm run dist

> electron-next-skeleton@1.0.0 dist E:\next_js\electron-next-skeleton
> npm run build && bundle


> electron-next-skeleton@1.0.0 build E:\next_js\electron-next-skeleton
> next build renderer && next export renderer

> Using "webpack" config function defined in next.config.js.
  using build directory: E:\next_js\electron-next-skeleton\renderer\.next
  exporting path: /start

"bundle" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron-next-skeleton@1.0.0 dist: `npm run build && bundle`
npm ERR! Exit status 1

@realtebo
Copy link

realtebo commented Nov 1, 2018

PS: please update the code, to use last version of all dependencies !

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