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

Preload on the webPreferences not working #54

Closed
exiadb opened this issue Nov 2, 2017 · 3 comments
Closed

Preload on the webPreferences not working #54

exiadb opened this issue Nov 2, 2017 · 3 comments

Comments

@exiadb
Copy link

exiadb commented Nov 2, 2017

in my electron-webpack.json

        "extraEntries": [
            "@/preload.js"
        ],
        "sourceDirectory": "src/main"
    }

and in my main process,
in src/main/create-window.js

const win = new BrowserWindow({
    minWidth: 1024,
    minHeight: 768,
    width: 1024,
    height: 768,
    webPreferences: {
      nodeIntegration: isDev,
      preload: path.join(__dirname, './preload.js')
    },
    show: false
  })

however after I loaded the dev app, the script is not being loaded.

@walleXD
Copy link

walleXD commented Nov 5, 2017

@exiadb trypath.resolve and see if it works

@exiadb
Copy link
Author

exiadb commented Nov 5, 2017

Thanks, @walleXD it started working now!

 Electron -------------------

  path.resolve(__dirname, 'preload.js') /Users/***/electron-webpack-quick-start/src/main/preload.js

┗ ----------------------------
┏ Electron -------------------

  path.join(__dirname, 'preload.js') src/main/preload.js

@exiadb exiadb closed this as completed Nov 5, 2017
@yanlee26
Copy link

the develop experience is really really bad

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

3 participants