mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
feat: enable the ESM for main (#3588)
This commit is contained in:
@ -35,15 +35,16 @@ export default defineConfig({
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
publicDir: 'assets',
|
publicDir: 'assets',
|
||||||
|
define: {
|
||||||
|
'__dirname': 'import.meta.dirname',
|
||||||
|
'__filename': 'import.meta.filename',
|
||||||
|
},
|
||||||
build: {
|
build: {
|
||||||
lib: {
|
lib: {
|
||||||
entry: 'src/index.ts',
|
entry: 'src/index.ts',
|
||||||
formats: ['cjs'],
|
formats: ['es'],
|
||||||
},
|
},
|
||||||
outDir: 'dist/main',
|
outDir: 'dist/main',
|
||||||
commonjsOptions: {
|
|
||||||
ignoreDynamicRequires: true,
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['electron', 'custom-electron-prompt', ...builtinModules],
|
external: ['electron', 'custom-electron-prompt', ...builtinModules],
|
||||||
input: './src/index.ts',
|
input: './src/index.ts',
|
||||||
@ -148,9 +149,6 @@ export default defineConfig({
|
|||||||
name: 'renderer',
|
name: 'renderer',
|
||||||
},
|
},
|
||||||
outDir: 'dist/renderer',
|
outDir: 'dist/renderer',
|
||||||
commonjsOptions: {
|
|
||||||
ignoreDynamicRequires: true,
|
|
||||||
},
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['electron', ...builtinModules],
|
external: ['electron', ...builtinModules],
|
||||||
input: './src/index.html',
|
input: './src/index.html',
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
"version": "3.9.0",
|
"version": "3.9.0",
|
||||||
"description": "YouTube Music Desktop App - including custom plugins",
|
"description": "YouTube Music Desktop App - including custom plugins",
|
||||||
"main": "./dist/main/index.js",
|
"main": "./dist/main/index.js",
|
||||||
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "th-ch/youtube-music",
|
"repository": "th-ch/youtube-music",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@ -74,9 +74,6 @@ unhandled({
|
|||||||
showDialog: false,
|
showDialog: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable Node options if the env var is set
|
|
||||||
process.env.NODE_OPTIONS = '';
|
|
||||||
|
|
||||||
// Prevent window being garbage collected
|
// Prevent window being garbage collected
|
||||||
let mainWindow: Electron.BrowserWindow | null;
|
let mainWindow: Electron.BrowserWindow | null;
|
||||||
autoUpdater.autoDownload = false;
|
autoUpdater.autoDownload = false;
|
||||||
@ -361,7 +358,7 @@ async function createMainWindow() {
|
|||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
preload: path.join(__dirname, '..', 'preload', 'preload.js'),
|
preload: path.join(__dirname, '..', 'preload', 'preload.cjs'),
|
||||||
...(isTesting()
|
...(isTesting()
|
||||||
? undefined
|
? undefined
|
||||||
: {
|
: {
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
import { sortSegments } from '../segments';
|
||||||
const { test, expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
const { sortSegments } = require('../segments');
|
|
||||||
|
|
||||||
test('Segment sorting', () => {
|
test('Segment sorting', () => {
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
const path = require('node:path');
|
import { _electron as electron } from 'playwright';
|
||||||
|
import { test, expect } from '@playwright/test';
|
||||||
const { _electron: electron } = require('playwright');
|
|
||||||
const { test, expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
process.env.NODE_ENV = 'test';
|
process.env.NODE_ENV = 'test';
|
||||||
|
|
||||||
const appPath = path.resolve(__dirname, '..');
|
const appPath = path.resolve(import.meta.dirname, '..');
|
||||||
|
|
||||||
test('YouTube Music App - With default settings, app is launched and visible', async () => {
|
test('YouTube Music App - With default settings, app is launched and visible', async () => {
|
||||||
const app = await electron.launch({
|
const app = await electron.launch({
|
||||||
|
|||||||
Reference in New Issue
Block a user