Skip to content

Commit f947936

Browse files
authored
fix(vite-template): fix vite template start failed after package (#3713)
* fix(vite-template): use import instead require for start failed after package * chore(vite-template): remove forge.env.d.ts from js template * chore(vite-template): remove electron-squirrel-startup type define
1 parent a2d704e commit f947936

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

packages/template/base/tmpl/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
const { app, BrowserWindow } = require('electron');
2-
const path = require('node:path');
1+
import { app, BrowserWindow } from 'electron';
2+
import path from 'node:path';
3+
import started from 'electron-squirrel-startup';
34

45
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
5-
if (require('electron-squirrel-startup')) {
6+
if (started) {
67
app.quit();
78
}
89

packages/template/vite-typescript/tmpl/main.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { app, BrowserWindow } from 'electron';
22
import path from 'path';
3+
import started from 'electron-squirrel-startup';
34

45
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
5-
if (require('electron-squirrel-startup')) {
6+
if (started) {
67
app.quit();
78
}
89

packages/template/vite/src/ViteTemplate.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class ViteTemplate extends BaseTemplate {
1515
title: 'Setting up Forge configuration',
1616
task: async () => {
1717
await this.copyTemplateFile(directory, 'forge.config.js');
18-
await this.copyTemplateFile(directory, 'forge.env.d.ts');
1918
},
2019
},
2120
{

packages/template/vite/test/ViteTemplate_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ describe('ViteTemplate', () => {
2828
context('template files are copied to project', () => {
2929
const expectedFiles = [
3030
'package.json',
31-
'forge.env.d.ts',
3231
'forge.config.js',
3332
'vite.main.config.mjs',
3433
'vite.preload.config.mjs',

packages/template/vite/tmpl/forge.env.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)