electron-react-boilerplate / electron-react-boilerplate/electron-react-boilerplate
Custom Protocol for Deep Link no working in Development
- Dominant language
- TypeScript
- Stars
- 24.3k
- Forks
- 4k
- Avg merge
- 20m
- Merged PRs (30d)
- 4
Description
Hello, I'm created custom protocol for deep link.
code is like bottom.
src/main/main.ts
```ts
app.removeAsDefaultProtocolClient('customtest');
if (process.defaultApp) {
console.log(process.execPath);
console.log(process.argv);
if (process.env.NODE_ENV === 'development' && process.platform === 'win32') {
app.setAsDefaultProtocolClient('customtest', process.execPath, [
process.argv[1],
path.resolve(process.argv[2]),
process.argv[3],
path.join(
__dirname,
'..',
'..',
'node_modules',
'ts-node',
'register',
'transpile-only.js'
),
path.resolve(process.argv[5]),
]);
} else if (process.platform === 'win32') {
app.setAsDefaultProtocolClient('customtest', process.execPath, []);
} else {
app.setAsDefaultProtocolClient('customtest');
}
} else {
app.setAsDefaultProtocolClient('pixellauncher', process.execPath);
}
const gotTheLock = app.requestSingleInstanceLock();
(skip)
app.on('open-url', (event, url) => {
dialog.showErrorBox('Welcome Back', `You arrived from: ${url}`);
});
```

When I package the app, it's working well. but run development with `npm run start`, then it cause the error "unable to parse" like this.
```
[
'C:\\Users\\tilto\\Documents\\git-projects\\***\\node_modules\\electron\\dist\\electron.exe',
'--require',
'C:\\Users\\tilto\\Documents\\git-projects\\***\\node_modules\\electronmon\\src\\hook.js',
'-r',
'ts-node/register/transpile-only',
'.'
]
```
I checked process argument like this.
so this is protocol set in development.
```ts
app.setAsDefaultProtocolClient('customtest', process.execPath, [
process.argv[1],
path.resolve(process.argv[2]),
process.argv[3],
path.join(
__dirname,
'..',
'..',
'node_modules',
'ts-node',
'register',
'transpile-only.js'
),
path.resolve(process.argv[5]),
]);
```
How can I get Custom Protocol for Deep Link to work in Development in Electron React Boilerplate?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.