diff --git a/app/webpack.config.main.mjs b/app/webpack.config.main.mjs index 8b10e20ff..793f1eb68 100644 --- a/app/webpack.config.main.mjs +++ b/app/webpack.config.main.mjs @@ -1,7 +1,8 @@ import * as path from 'path' import wp from 'webpack' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) const config = { name: 'tabby-main', diff --git a/app/webpack.config.mjs b/app/webpack.config.mjs index 8c7da4a61..bcfa13060 100644 --- a/app/webpack.config.mjs +++ b/app/webpack.config.mjs @@ -1,7 +1,9 @@ import * as fs from 'fs' import * as path from 'path' import wp from 'webpack' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import { AngularWebpackPlugin } from '@ngtools/webpack' import { createEs2015LinkerPlugin } from '@angular/compiler-cli/linker/babel' const linkerPlugin = createEs2015LinkerPlugin({ diff --git a/scripts/build-native.mjs b/scripts/build-native.mjs index ad6e2a825..054a1ee07 100755 --- a/scripts/build-native.mjs +++ b/scripts/build-native.mjs @@ -3,7 +3,9 @@ import { rebuild } from 'electron-rebuild' import * as path from 'path' import * as vars from './vars.mjs' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + if (process.platform === 'win32' || process.platform === 'linux') { process.env.ARCH = ((process.env.ARCH || process.arch) === 'arm') ? 'armv7l' : process.env.ARCH || process.arch diff --git a/scripts/generate-icon-metadata.mjs b/scripts/generate-icon-metadata.mjs index 339877f54..a7b780146 100755 --- a/scripts/generate-icon-metadata.mjs +++ b/scripts/generate-icon-metadata.mjs @@ -3,7 +3,9 @@ import jsYaml from 'js-yaml' import fs from 'node:fs' import path from 'node:path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + const metadata = jsYaml.load(fs.readFileSync(path.resolve(__dirname, '../node_modules/@fortawesome/fontawesome-free/metadata/icons.yml'))) diff --git a/scripts/prepackage-plugins.mjs b/scripts/prepackage-plugins.mjs index 5d3148192..2176c1ed1 100755 --- a/scripts/prepackage-plugins.mjs +++ b/scripts/prepackage-plugins.mjs @@ -6,7 +6,9 @@ import fs from 'node:fs' import * as vars from './vars.mjs' import log from 'npmlog' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + let target = path.resolve(__dirname, '../builtin-plugins') sh.mkdir('-p', target) diff --git a/scripts/vars.mjs b/scripts/vars.mjs index 4dd9bd762..9f4e2d456 100755 --- a/scripts/vars.mjs +++ b/scripts/vars.mjs @@ -3,7 +3,8 @@ import * as fs from 'fs' import * as semver from 'semver' import * as childProcess from 'child_process' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) const electronInfo = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../node_modules/electron/package.json'))) diff --git a/tabby-community-color-schemes/webpack.config.mjs b/tabby-community-color-schemes/webpack.config.mjs index fc89447ed..152192632 100644 --- a/tabby-community-color-schemes/webpack.config.mjs +++ b/tabby-community-color-schemes/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => { diff --git a/tabby-core/webpack.config.mjs b/tabby-core/webpack.config.mjs index befde6cc4..a0f14443a 100644 --- a/tabby-core/webpack.config.mjs +++ b/tabby-core/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-electron/webpack.config.mjs b/tabby-electron/webpack.config.mjs index 9a695bc88..a00e0af30 100644 --- a/tabby-electron/webpack.config.mjs +++ b/tabby-electron/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-linkifier/webpack.config.mjs b/tabby-linkifier/webpack.config.mjs index 3d7248ca1..a79dcb895 100644 --- a/tabby-linkifier/webpack.config.mjs +++ b/tabby-linkifier/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-local/webpack.config.mjs b/tabby-local/webpack.config.mjs index 0f23e306c..3aaab772d 100644 --- a/tabby-local/webpack.config.mjs +++ b/tabby-local/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-plugin-manager/webpack.config.mjs b/tabby-plugin-manager/webpack.config.mjs index 68c471756..c0fbb3cc2 100644 --- a/tabby-plugin-manager/webpack.config.mjs +++ b/tabby-plugin-manager/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-serial/webpack.config.mjs b/tabby-serial/webpack.config.mjs index 5de5a31db..94afefc4a 100644 --- a/tabby-serial/webpack.config.mjs +++ b/tabby-serial/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-settings/webpack.config.mjs b/tabby-settings/webpack.config.mjs index 73863ebea..7f6e05a2a 100644 --- a/tabby-settings/webpack.config.mjs +++ b/tabby-settings/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-ssh/webpack.config.mjs b/tabby-ssh/webpack.config.mjs index 69c1e1634..16ce381b0 100644 --- a/tabby-ssh/webpack.config.mjs +++ b/tabby-ssh/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-telnet/webpack.config.mjs b/tabby-telnet/webpack.config.mjs index a3e10c8dc..d8d82b0dd 100644 --- a/tabby-telnet/webpack.config.mjs +++ b/tabby-telnet/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-terminal/webpack.config.mjs b/tabby-terminal/webpack.config.mjs index 8ea38b00f..8fc3d3d04 100644 --- a/tabby-terminal/webpack.config.mjs +++ b/tabby-terminal/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => { diff --git a/tabby-web-demo/webpack.config.mjs b/tabby-web-demo/webpack.config.mjs index f2bd8fc74..3b4735d22 100644 --- a/tabby-web-demo/webpack.config.mjs +++ b/tabby-web-demo/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/tabby-web/webpack.config.mjs b/tabby-web/webpack.config.mjs index aa0f510a2..52596a62e 100644 --- a/tabby-web/webpack.config.mjs +++ b/tabby-web/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + import config from '../webpack.plugin.config.mjs' export default () => config({ diff --git a/web/webpack.config.mjs b/web/webpack.config.mjs index b30dc485e..dadba2d32 100644 --- a/web/webpack.config.mjs +++ b/web/webpack.config.mjs @@ -1,5 +1,7 @@ import * as path from 'path' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +import * as url from 'url' +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)) + const externals = {} for (const key of [