diff --git a/.github/actions/download-web/action.yml b/.github/actions/download-static-zip/action.yml similarity index 82% rename from .github/actions/download-web/action.yml rename to .github/actions/download-static-zip/action.yml index b5ea42e6d8cff..bab8d38629ae9 100644 --- a/.github/actions/download-web/action.yml +++ b/.github/actions/download-static-zip/action.yml @@ -4,6 +4,9 @@ inputs: path: description: 'Path to extract' required: true + name: + description: 'Name of the artifact' + required: true runs: using: 'composite' @@ -11,7 +14,7 @@ runs: - name: Download tar.gz uses: actions/download-artifact@v4 with: - name: web + name: ${{ inputs.name }} path: . - name: Extract core artifacts diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index d1599299fa3cc..ec5af4039662e 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -271,9 +271,23 @@ jobs: path: ./packages/backend/native/server-native.node if-no-files-found: error - build-electron-renderer: - name: Build @affine/electron renderer + build-static-assets: + name: Build ${{ matrix.apps.name }} runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + apps: + - { + name: 'Electron renderer', + distribution: desktop, + directory: packages/frontend/apps/electron/renderer/dist, + } + - { + name: 'Web', + distribution: web, + directory: packages/frontend/apps/web/dist, + } steps: - uses: actions/checkout@v4 @@ -282,17 +296,17 @@ jobs: with: electron-install: false full-cache: true - - name: Build Electron renderer + - name: Build ${{ matrix.apps.name }} # always skip cache because its fast, and cache configuration is always changing - run: yarn build + run: yarn build --static env: - DISTRIBUTION: desktop - - name: zip web - run: tar -czf dist.tar.gz --directory=packages/frontend/apps/electron/renderer/dist . - - name: Upload web artifact + DISTRIBUTION: ${{ matrix.apps.distribution }} + - name: zip ${{ matrix.apps.name }} + run: tar -czf dist.tar.gz --directory=${{ matrix.apps.directory }} . + - name: Upload ${{ matrix.apps.name }} artifact uses: actions/upload-artifact@v4 with: - name: web + name: ${{ matrix.apps.distribution }} path: dist.tar.gz if-no-files-found: error @@ -555,12 +569,16 @@ jobs: matrix: tests: - name: 'Server E2E Test 1/3' + artifact: test-results-e2e-server-1 script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=1/3 - name: 'Server E2E Test 2/3' + artifact: test-results-e2e-server-2 script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=2/3 - name: 'Server E2E Test 3/3' + artifact: test-results-e2e-server-3 script: yarn workspace @affine-test/affine-cloud e2e --forbid-only --shard=3/3 - name: 'Server Desktop E2E Test' + artifact: test-results-e2e-server-desktop script: | yarn workspace @affine/electron build:dev # Workaround for Electron apps failing to initialize on Ubuntu 24.04 due to AppArmor restrictions @@ -571,6 +589,7 @@ jobs: needs: - build-server-native - build-native + - build-static-assets services: postgres: image: postgres @@ -601,6 +620,18 @@ jobs: playwright-install: true hard-link-nm: false + - name: Download desktop artifact + uses: ./.github/actions/download-static-zip + with: + path: packages/frontend/apps/electron/renderer/dist + name: desktop + + - name: Download web artifact + uses: ./.github/actions/download-static-zip + with: + path: packages/frontend/apps/web/dist + name: web + - name: Download server-native.node uses: actions/download-artifact@v4 with: @@ -628,7 +659,7 @@ jobs: if: ${{ failure() }} uses: actions/upload-artifact@v4 with: - name: test-results-e2e-server + name: test-results-e2e-server-${{ matrix.tests.artifact }} path: ./test-results if-no-files-found: ignore @@ -668,7 +699,7 @@ jobs: test: true, } needs: - - build-electron-renderer + - build-static-assets - build-native steps: - uses: actions/checkout@v4 @@ -699,10 +730,17 @@ jobs: shell: bash run: yarn workspace @affine/electron vitest - - name: Download web artifact - uses: ./.github/actions/download-web + - name: Download desktop artifact (For Bundle) + uses: ./.github/actions/download-static-zip with: path: packages/frontend/apps/electron/resources/web-static + name: desktop + + - name: Download desktop artifact + uses: ./.github/actions/download-static-zip + with: + path: packages/frontend/apps/electron/renderer/dist + name: desktop - name: Build Desktop Layers run: yarn workspace @affine/electron build @@ -745,7 +783,7 @@ jobs: - name: Output check if: ${{ matrix.spec.os == 'macos-14' && matrix.spec.arch == 'arm64' }} run: | - yarn workspace @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts + yarn workspace @affine/electron exec node --import @oxc-node/core/register ./scripts/macos-arm64-output-check.ts - name: Upload test results if: ${{ failure() }} @@ -774,7 +812,7 @@ jobs: - unit-test - build-native - build-server-native - - build-electron-renderer + - build-static-assets - server-test - rust-test - copilot-api-test diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index c62cb8678e308..e739d33f344c7 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -63,10 +63,10 @@ jobs: SKIP_NX_CACHE: 'true' MIXPANEL_TOKEN: ${{ secrets.MIXPANEL_TOKEN }} - - name: Upload web artifact + - name: Upload desktop artifact uses: actions/upload-artifact@v4 with: - name: web + name: desktop path: packages/frontend/apps/electron/resources/web-static make-distribution: @@ -120,7 +120,7 @@ jobs: nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - uses: actions/download-artifact@v4 with: - name: web + name: desktop path: packages/frontend/apps/electron/resources/web-static - name: Build Desktop Layers diff --git a/packages/frontend/apps/android/package.json b/packages/frontend/apps/android/package.json index d8e8832fd6635..aa636a350e002 100644 --- a/packages/frontend/apps/android/package.json +++ b/packages/frontend/apps/android/package.json @@ -6,8 +6,7 @@ "browser": "src/index.tsx", "scripts": { "build": "cross-env DISTRIBUTION=android yarn workspace @affine/cli bundle", - "dev": "yarn workspace @affine/cli dev", - "static-server": "cross-env DISTRIBUTION=android yarn workspace @affine/cli dev --static" + "dev": "yarn workspace @affine/cli dev" }, "dependencies": { "@affine/component": "workspace:*", diff --git a/packages/frontend/apps/electron/package.json b/packages/frontend/apps/electron/package.json index a20be5b11a5d8..4eacbcfdd80cd 100644 --- a/packages/frontend/apps/electron/package.json +++ b/packages/frontend/apps/electron/package.json @@ -42,6 +42,7 @@ "@electron-forge/plugin-auto-unpack-natives": "^7.6.0", "@electron-forge/shared-types": "^7.6.0", "@emotion/react": "^11.14.0", + "@oxc-node/core": "^0.0.16", "@pengx17/electron-forge-maker-appimage": "^1.2.1", "@sentry/electron": "^5.8.0", "@sentry/esbuild-plugin": "^2.22.7", diff --git a/packages/frontend/apps/ios/package.json b/packages/frontend/apps/ios/package.json index c3aa1b6c1f38a..6dd1362246db0 100644 --- a/packages/frontend/apps/ios/package.json +++ b/packages/frontend/apps/ios/package.json @@ -8,8 +8,7 @@ "build": "cross-env DISTRIBUTION=ios yarn workspace @affine/cli bundle", "dev": "yarn workspace @affine/cli dev", "sync": "yarn cap sync", - "sync:dev": "CAP_SERVER_URL=http://localhost:8080 yarn cap sync", - "static-server": "cross-env DISTRIBUTION=ios yarn workspace @affine/cli dev --static" + "sync:dev": "CAP_SERVER_URL=http://localhost:8080 yarn cap sync" }, "dependencies": { "@affine/component": "workspace:*", diff --git a/packages/frontend/apps/mobile/package.json b/packages/frontend/apps/mobile/package.json index ae1d786897b6a..d8a01f929bcbe 100644 --- a/packages/frontend/apps/mobile/package.json +++ b/packages/frontend/apps/mobile/package.json @@ -6,8 +6,7 @@ "browser": "src/index.tsx", "scripts": { "build": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli bundle", - "dev": "yarn workspace @affine/cli dev", - "static-server": "cross-env DISTRIBUTION=mobile yarn workspace @affine/cli dev --static" + "dev": "yarn workspace @affine/cli dev" }, "dependencies": { "@affine/component": "workspace:*", diff --git a/packages/frontend/apps/web/package.json b/packages/frontend/apps/web/package.json index b3a995920f089..2abf82a1ca5ae 100644 --- a/packages/frontend/apps/web/package.json +++ b/packages/frontend/apps/web/package.json @@ -6,8 +6,7 @@ "browser": "src/index.tsx", "scripts": { "build": "cross-env DISTRIBUTION=web yarn workspace @affine/cli bundle", - "dev": "yarn workspace @affine/cli dev", - "static-server": "yarn workspace @affine/cli dev --static" + "dev": "yarn workspace @affine/cli dev" }, "dependencies": { "@affine/component": "workspace:*", diff --git a/tests/affine-cloud-copilot/playwright.config.ts b/tests/affine-cloud-copilot/playwright.config.ts index 4b6736354bba5..9ba51c139d306 100644 --- a/tests/affine-cloud-copilot/playwright.config.ts +++ b/tests/affine-cloud-copilot/playwright.config.ts @@ -26,14 +26,16 @@ const config: PlaywrightTestConfig = { retries: 3, reporter: process.env.CI ? 'github' : 'list', webServer: [ - // Intentionally not building the web, reminds you to run it by yourself. { - command: 'yarn -T run start:web-static', + command: 'yarn -T run dev', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, env: { COVERAGE: process.env.COVERAGE || 'false', + DISTRIBUTION: 'web', + BUILD_TYPE: 'canary', + ...process.env, }, }, { diff --git a/tests/affine-cloud/playwright.config.ts b/tests/affine-cloud/playwright.config.ts index 68e8d852e5e3f..c8f82e3f9c534 100644 --- a/tests/affine-cloud/playwright.config.ts +++ b/tests/affine-cloud/playwright.config.ts @@ -26,14 +26,17 @@ const config: PlaywrightTestConfig = { retries: process.env.COPILOT ? 1 : 3, reporter: process.env.CI ? 'github' : 'list', webServer: [ - // Intentionally not building the web, reminds you to run it by yourself. { - command: 'yarn -T run start:web-static', + command: 'yarn -T run dev --static', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, env: { + ...process.env, COVERAGE: process.env.COVERAGE || 'false', + DISTRIBUTION: 'web', + BUILD_TYPE: 'canary', + PLAYWRIGHT_DEV_SERVER: 'true', }, }, { diff --git a/tests/affine-desktop-cloud/playwright.config.ts b/tests/affine-desktop-cloud/playwright.config.ts index 3432035187049..c6f1d8652a4a2 100644 --- a/tests/affine-desktop-cloud/playwright.config.ts +++ b/tests/affine-desktop-cloud/playwright.config.ts @@ -1,6 +1,5 @@ import { testResultDir } from '@affine-test/kit/playwright'; import type { PlaywrightTestConfig } from '@playwright/test'; -// import { devices } from '@playwright/test'; /** * Read environment variables from file. @@ -21,16 +20,17 @@ const config: PlaywrightTestConfig = { }, reporter: process.env.CI ? 'github' : 'list', webServer: [ - // Intentionally not building the web, reminds you to run it by yourself. { - command: 'yarn -T run start:web-static', + command: 'yarn -T run dev', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, stdout: 'pipe', env: { + ...process.env, COVERAGE: process.env.COVERAGE || 'false', DISTRIBUTION: 'desktop', + BUILD_TYPE: 'canary', }, }, { @@ -49,7 +49,11 @@ const config: PlaywrightTestConfig = { DEBUG: 'affine:*', FORCE_COLOR: 'true', DEBUG_COLORS: 'true', + MAILER_HOST: '0.0.0.0', + MAILER_PORT: '1025', MAILER_SENDER: 'noreply@toeverything.info', + MAILER_USER: 'noreply@toeverything.info', + MAILER_PASSWORD: 'affine', }, }, ], diff --git a/tests/affine-desktop/package.json b/tests/affine-desktop/package.json index b0386015a3302..b56f7c49c2d08 100644 --- a/tests/affine-desktop/package.json +++ b/tests/affine-desktop/package.json @@ -2,7 +2,7 @@ "name": "@affine-test/affine-desktop", "private": true, "scripts": { - "e2e": "DEBUG=pw:browser yarn playwright test" + "e2e": "yarn playwright test" }, "devDependencies": { "@affine-test/kit": "workspace:*", diff --git a/tests/affine-desktop/playwright.config.ts b/tests/affine-desktop/playwright.config.ts index f6cd39740d55d..7f6f15a243ad9 100644 --- a/tests/affine-desktop/playwright.config.ts +++ b/tests/affine-desktop/playwright.config.ts @@ -2,7 +2,6 @@ import assert from 'node:assert'; import { testResultDir } from '@affine-test/kit/playwright'; import type { PlaywrightTestConfig } from '@playwright/test'; -// import { devices } from '@playwright/test'; /** * Read environment variables from file. @@ -41,12 +40,16 @@ if (process.env.DEV_SERVER_URL) { ); config.webServer = [ { - command: 'yarn run start:web-static', + command: 'yarn -T run dev --static', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, env: { COVERAGE: process.env.COVERAGE || 'false', + DISTRIBUTION: 'desktop', + BUILD_TYPE: 'canary', + PLAYWRIGHT_DEV_SERVER: 'true', + ...process.env, }, }, ]; diff --git a/tests/affine-local/playwright.config.ts b/tests/affine-local/playwright.config.ts index 8337cb53b111a..4a23c328ee124 100644 --- a/tests/affine-local/playwright.config.ts +++ b/tests/affine-local/playwright.config.ts @@ -3,7 +3,6 @@ import type { PlaywrightTestConfig, PlaywrightWorkerOptions, } from '@playwright/test'; -// import { devices } from '@playwright/test'; /** * Read environment variables from file. @@ -44,14 +43,17 @@ const config: PlaywrightTestConfig = { reporter: process.env.CI ? 'github' : 'list', webServer: [ - // Intentionally not building the web, reminds you to run it by yourself. { - command: 'yarn run start:web-static', + command: 'yarn -T run dev', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, env: { + ...process.env, COVERAGE: process.env.COVERAGE || 'false', + DISTRIBUTION: 'web', + BUILD_TYPE: 'canary', + CI: '1', }, }, ], diff --git a/tests/affine-mobile/playwright.config.ts b/tests/affine-mobile/playwright.config.ts index 6804256482284..f34066ed7c419 100644 --- a/tests/affine-mobile/playwright.config.ts +++ b/tests/affine-mobile/playwright.config.ts @@ -49,12 +49,16 @@ const config: PlaywrightTestConfig = { webServer: [ // Intentionally not building the web, reminds you to run it by yourself. { - command: 'yarn workspace @affine/mobile static-server', + command: 'yarn -T run dev', port: 8080, timeout: 120 * 1000, reuseExistingServer: !process.env.CI, env: { COVERAGE: process.env.COVERAGE || 'false', + DISTRIBUTION: 'mobile', + BUILD_TYPE: 'canary', + CI: '1', + ...process.env, }, }, ], diff --git a/tools/cli/package.json b/tools/cli/package.json index ee11989048b11..f3722a2189594 100644 --- a/tools/cli/package.json +++ b/tools/cli/package.json @@ -11,6 +11,7 @@ "@clack/prompts": "^0.8.2", "@magic-works/i18n-codegen": "^0.6.1", "@napi-rs/simple-git": "^0.1.19", + "@oxc-node/core": "^0.0.16", "@perfsee/webpack": "^1.13.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15", "@sentry/webpack-plugin": "^2.22.7", @@ -33,16 +34,15 @@ "style-loader": "^4.0.0", "swc-loader": "^0.2.6", "tailwindcss": "^3.4.16", - "terser-webpack-plugin": "^5.3.10", - "ts-node": "^10.9.2", + "terser-webpack-plugin": "^5.3.11", "vite": "^6.0.3", "webpack": "^5.97.1", "webpack-dev-server": "^5.2.0", "webpack-merge": "^6.0.1" }, "scripts": { - "bundle": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/build.ts", - "dev": "node --loader ts-node/esm/transpile-only.mjs ./src/bin/dev.ts" + "bundle": "node --import @oxc-node/core/register ./src/bin/build.ts", + "dev": "node --import @oxc-node/core/register ./src/bin/dev.ts" }, "version": "0.18.0" } diff --git a/tools/cli/src/bin/build.ts b/tools/cli/src/bin/build.ts index 64113974a61dd..f284edb566eb7 100644 --- a/tools/cli/src/bin/build.ts +++ b/tools/cli/src/bin/build.ts @@ -6,7 +6,6 @@ import { getCwdFromDistribution } from '../config/cwd.cjs'; import type { BuildFlags } from '../config/index.js'; import { createWebpackConfig } from '../webpack/webpack.config.js'; -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion const buildType = process.env.BUILD_TYPE_OVERRIDE || process.env.BUILD_TYPE; if (process.env.BUILD_TYPE_OVERRIDE) { @@ -46,15 +45,14 @@ const flags = { channel: getChannel(), coverage: process.env.COVERAGE === 'true', entry, - static: false, + static: process.argv.includes('--static'), } satisfies BuildFlags; spawn('yarn', ['workspace', '@affine/i18n', 'build'], { stdio: 'inherit', }); -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -webpack(createWebpackConfig(cwd!, flags), (err, stats) => { +webpack(createWebpackConfig(cwd, flags), (err, stats) => { if (err) { console.error(err); process.exit(1); diff --git a/tools/cli/src/bin/dev.ts b/tools/cli/src/bin/dev.ts index 8962d797e263b..3325519457920 100644 --- a/tools/cli/src/bin/dev.ts +++ b/tools/cli/src/bin/dev.ts @@ -11,13 +11,13 @@ import { getCwdFromDistribution, projectRoot } from '../config/cwd.cjs'; import type { BuildFlags } from '../config/index.js'; import { createWebpackConfig } from '../webpack/webpack.config.js'; -const flags: BuildFlags = { - distribution: - (process.env.DISTRIBUTION as BuildFlags['distribution']) ?? 'web', +const flags: BuildFlags & { ci: boolean } = { + distribution: process.env.DISTRIBUTION as BuildFlags['distribution'], mode: 'development', - static: false, + static: process.argv.includes('--static'), channel: 'canary', coverage: process.env.COVERAGE === 'true', + ci: !!process.env.CI || !!process.env.IN_CI_TEST, }; const files = ['.env', '.env.local']; @@ -32,74 +32,77 @@ for (const file of files) { } } -const buildFlags = process.argv.includes('--static') - ? { ...flags, static: true } - : ((await p.group( - { - distribution: () => - p.select({ - message: 'Distribution', - options: [ - { - value: 'web', - }, - { - value: 'desktop', - }, - { - value: 'admin', - }, - { - value: 'mobile', - }, - { - value: 'ios', - }, - ], - initialValue: 'web', - }), - mode: () => - p.select({ - message: 'Mode', - options: [ - { - value: 'development', - }, - { - value: 'production', - }, - ], - initialValue: 'development', - }), - channel: () => - p.select({ - message: 'Channel', - options: [ - { - value: 'canary', - }, - { - value: 'beta', - }, - { - value: 'stable', - }, - ], - initialValue: 'canary', - }), - coverage: () => - p.confirm({ - message: 'Enable coverage', - initialValue: process.env.COVERAGE === 'true', - }), - }, - { - onCancel: () => { - p.cancel('Operation cancelled.'); - process.exit(0); +const buildFlags = flags.static + ? flags + : // skip interactive mode in CI + flags.ci + ? flags + : ((await p.group( + { + distribution: () => + p.select({ + message: 'Distribution', + options: [ + { + value: 'web', + }, + { + value: 'desktop', + }, + { + value: 'admin', + }, + { + value: 'mobile', + }, + { + value: 'ios', + }, + ], + initialValue: 'web', + }), + mode: () => + p.select({ + message: 'Mode', + options: [ + { + value: 'development', + }, + { + value: 'production', + }, + ], + initialValue: 'development', + }), + channel: () => + p.select({ + message: 'Channel', + options: [ + { + value: 'canary', + }, + { + value: 'beta', + }, + { + value: 'stable', + }, + ], + initialValue: 'canary', + }), + coverage: () => + p.confirm({ + message: 'Enable coverage', + initialValue: process.env.COVERAGE === 'true', + }), }, - } - )) as BuildFlags); + { + onCancel: () => { + p.cancel('Operation cancelled.'); + process.exit(0); + }, + } + )) as BuildFlags & { ci: boolean }); flags.distribution = buildFlags.distribution; flags.mode = buildFlags.mode; @@ -134,6 +137,9 @@ try { const config = createWebpackConfig(cwd, flags); if (flags.static) { config.watch = false; + config.entry = { + _undefined_entry: join(import.meta.dirname, 'empty.ts'), + }; } const compiler = webpack(config); // Start webpack diff --git a/tools/cli/src/bin/empty.ts b/tools/cli/src/bin/empty.ts new file mode 100644 index 0000000000000..47b5582ef2fbc --- /dev/null +++ b/tools/cli/src/bin/empty.ts @@ -0,0 +1,5 @@ +// This file is aim to reuse webpack devServer in the serve:static mode +// In serve:static mode, the sources are built in previous pipeline +// So we need to provide a empty entry to webpack to make devServer work + +const _a = void 0; diff --git a/tools/cli/src/webpack/config.ts b/tools/cli/src/webpack/config.ts index e39038277d9df..50d524418771e 100644 --- a/tools/cli/src/webpack/config.ts +++ b/tools/cli/src/webpack/config.ts @@ -31,7 +31,7 @@ const OptimizeOptionOptions: ( new TerserPlugin({ minify: TerserPlugin.swcMinify, exclude: [/plugins\/.+\/.+\.js$/, /plugins\/.+\/.+\.mjs$/], - parallel: true, + parallel: false, extractComments: true, terserOptions: { ecma: 2020, @@ -362,6 +362,16 @@ export const createConfiguration: ( }, historyApiFallback: true, static: [ + { + directory: join(cwd, 'dist'), + publicPath: '/', + watch: !buildFlags.static, + }, + { + directory: join(cwd, 'public'), + publicPath: '/', + watch: !buildFlags.static, + }, { directory: join( projectRoot, @@ -373,11 +383,6 @@ export const createConfiguration: ( publicPath: '/', watch: !buildFlags.static, }, - { - directory: join(cwd, 'public'), - publicPath: '/', - watch: !buildFlags.static, - }, ], proxy: [ { diff --git a/tools/cli/src/webpack/runtime-config.ts b/tools/cli/src/webpack/runtime-config.ts index c5d61254c46c5..75b1f7d839534 100644 --- a/tools/cli/src/webpack/runtime-config.ts +++ b/tools/cli/src/webpack/runtime-config.ts @@ -7,7 +7,9 @@ export function getBuildConfig(buildFlags: BuildFlags): BUILD_CONFIG_TYPE { const buildPreset: Record = { get stable() { return { - debug: buildFlags.mode === 'development', + debug: + buildFlags.mode === 'development' || + process.argv.includes('--static'), distribution: buildFlags.distribution, isDesktopEdition: ( ['web', 'desktop', 'admin'] as BuildFlags['distribution'][] diff --git a/tools/cli/src/webpack/webpack.config.ts b/tools/cli/src/webpack/webpack.config.ts index 290ce1fc386cc..d72878476d061 100644 --- a/tools/cli/src/webpack/webpack.config.ts +++ b/tools/cli/src/webpack/webpack.config.ts @@ -178,6 +178,9 @@ export function createWebpackConfig(cwd: string, flags: BuildFlags) { return merge(config, { entry, - plugins: Object.keys(entry).map(createHTMLPlugins).flat(), + plugins: + flags.static && process.env.PLAYWRIGHT_DEV_SERVER + ? [] + : Object.keys(entry).map(createHTMLPlugins).flat(), }); } diff --git a/yarn.lock b/yarn.lock index a27e7328c9beb..e5786dc481031 100644 --- a/yarn.lock +++ b/yarn.lock @@ -213,6 +213,7 @@ __metadata: "@clack/prompts": "npm:^0.8.2" "@magic-works/i18n-codegen": "npm:^0.6.1" "@napi-rs/simple-git": "npm:^0.1.19" + "@oxc-node/core": "npm:^0.0.16" "@perfsee/webpack": "npm:^1.13.0" "@pmmmwh/react-refresh-webpack-plugin": "npm:^0.5.15" "@sentry/webpack-plugin": "npm:^2.22.7" @@ -235,8 +236,7 @@ __metadata: style-loader: "npm:^4.0.0" swc-loader: "npm:^0.2.6" tailwindcss: "npm:^3.4.16" - terser-webpack-plugin: "npm:^5.3.10" - ts-node: "npm:^10.9.2" + terser-webpack-plugin: "npm:^5.3.11" vite: "npm:^6.0.3" webpack: "npm:^5.97.1" webpack-dev-server: "npm:^5.2.0" @@ -477,6 +477,7 @@ __metadata: "@electron-forge/plugin-auto-unpack-natives": "npm:^7.6.0" "@electron-forge/shared-types": "npm:^7.6.0" "@emotion/react": "npm:^11.14.0" + "@oxc-node/core": "npm:^0.0.16" "@pengx17/electron-forge-maker-appimage": "npm:^1.2.1" "@sentry/electron": "npm:^5.8.0" "@sentry/esbuild-plugin": "npm:^2.22.7" @@ -32198,7 +32199,7 @@ __metadata: languageName: node linkType: hard -"terser-webpack-plugin@npm:^5.3.10": +"terser-webpack-plugin@npm:^5.3.10, terser-webpack-plugin@npm:^5.3.11": version: 5.3.11 resolution: "terser-webpack-plugin@npm:5.3.11" dependencies: