Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: NodeJS with Webpack

on:
push:
branches: [ "canary" ]
pull_request:
branches: [ "canary" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: Build
run: |
pnpm install
npx webpack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The direct npx webpack command may fail since it requires webpack to be installed and properly configured. Next.js projects typically use their own build system through commands like pnpm build, which would leverage the project's existing configuration. Consider replacing this with the appropriate Next.js build command to ensure compatibility with the project's build pipeline.

Suggested change
npx webpack
pnpm build

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +30 to +33

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Build step invokes nonexistent webpack target

The workflow now runs npx webpack after a root pnpm install, but this repo is a pnpm/turbo monorepo without a root webpack dependency or config. On every push/PR to canary the job will fail because npx cannot find a webpack binary or project to build, so the workflow never succeeds.

Useful? React with 👍 / 👎.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
npx webpack
pnpm run test-webpack

The workflow will fail because npx webpack is run without any configuration or entry point. Webpack won't know what to bundle and will error out.

View Details

Analysis

Webpack workflow fails with missing configuration and entry point

What fails: The GitHub Actions workflow in .github/workflows/webpack.yml executes npx webpack without any configuration file or entry point, causing the build to fail with "Module not found: Error: Can't resolve './src'"

How to reproduce:

# Clone the repo and run the workflow steps:
pnpm install
npx webpack

Result:

ERROR in main
Module not found: Error: Can't resolve './src' in '/path/to/repo'
  using description file: /path/to/repo/package.json (relative path: .)
    using description file: /path/to/repo/package.json (relative path: ./src)
      no extension
        /path/to/repo/src doesn't exist
      .js
        /path/to/repo/src.js doesn't exist
      .json
        /path/to/repo/src.json doesn't exist
      .wasm
        /path/to/repo/src.wasm doesn't exist
      as directory
        /path/to/repo/src doesn't exist

webpack 5.98.0 compiled with 1 error and 1 warning in 38 ms

Expected: The workflow should successfully test webpack functionality using the existing test suite, not fail with missing module resolution.

Fix: Changed the workflow to run pnpm run test-webpack which is the appropriate webpack test command already defined in package.json. This aligns with the workflow's purpose of validating webpack compatibility while using actual project test infrastructure rather than attempting to bundle a non-existent entry point.

Comment on lines +25 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webpack workflow is missing pnpm store caching, which will cause significantly slower builds since dependencies need to be re-downloaded on every run. This is inconsistent with other workflows in the repository.

View Details
📝 Patch Details
diff --git a/.github/workflows/webpack.yml b/.github/workflows/webpack.yml
index 3b68272b91..299d869f76 100644
--- a/.github/workflows/webpack.yml
+++ b/.github/workflows/webpack.yml
@@ -27,6 +27,18 @@ jobs:
       with:
         version: 8
 
+    - id: get-store-path
+      run: echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT
+
+    - uses: actions/cache@v4
+      timeout-minutes: 5
+      id: cache-pnpm-store
+      with:
+        path: ${{ steps.get-store-path.outputs.STORE_PATH }}
+        key: pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
+        restore-keys: |
+          pnpm-store-
+
     - name: Build
       run: |
         pnpm install

Analysis

Missing pnpm store caching in webpack.yml workflow

What fails: The webpack.yml GitHub Actions workflow does not cache the pnpm store, resulting in dependencies being re-downloaded on every workflow run, while other workflows in the repository (build_and_deploy.yml and create_release_branch.yml) explicitly cache the pnpm store. This creates inconsistency and slower build times.

How to reproduce:

  1. Check .github/workflows/webpack.yml lines 25-33 - no pnpm store caching is present
  2. Compare with .github/workflows/build_and_deploy.yml lines 97-104 and .github/workflows/create_release_branch.yml lines 62-71 - both have explicit pnpm store caching using get-store-path and actions/cache@v4
  3. Run the webpack workflow - each execution will re-download all pnpm dependencies instead of using cached versions

Expected behavior: Per pnpm continuous integration documentation and GitHub Actions setup-node documentation, the workflow should cache the pnpm store path to avoid re-downloading dependencies. The pattern used in other workflows in this repository adds a get-store-path step that retrieves the pnpm store location, then caches it with actions/cache@v4 using the pnpm-lock.yaml hash as the cache key.

Fix applied: Added pnpm store caching steps matching the established pattern in other workflows, improving build performance and maintaining consistency across the repository.

Loading