parcel-bundler / parcel-bundler/lightningcss

Issue with lightningcss dependency in Vite 5.0 affecting Serverless deployment - Missing ../pkg

Open
#701 45 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
7.7k
Forks
302
PR merge metrics
No merged PRs in 30d

Description

https://github.com/parcel-bundler/lightningcss/blob/baa1a2b7fa52eeb3827f8edcc2e14de33cd69ad0/node/index.js#L16

Description

After upgrading to Vite 5.0 for our Serverless application, we encountered an issue related to the lightningcss dependency. Specifically, lightningcss tries to require a module using a relative path (../pkg), which does not exist in its package structure. This issue is causing our Serverless deployment process to fail, displaying the following error:

This problem seems to stem from the new version of Vite's dependency on lightningcss, which is now causing issues during the Serverless deployment phase.

Steps to Reproduce
  1. Upgrade Vite to version 5.0 in a Serverless project that uses lightningcss either directly or indirectly.
  2. Attempt to deploy the project using Serverless Framework (serverless deploy) or during the build process triggered by Serverless.
  3. Observe the error as the deployment or build process fails.
/bin/sh: line 1:  6615 Terminated              npm run deploy:testdev
ERROR Error: Command failed: cd fdnode && npm run deploy:testdev

Deploying fdssr to stage dev (ap-northeast-1)
��� [ERROR] Could not resolve "../pkg"

    node_modules/lightningcss/node/index.js:16:27:
      16 ���   module.exports = require(`../pkg`);
Expected Behavior

The Serverless deployment process should complete successfully without encountering errors related to missing modules in lightningcss.

Actual Behavior

The deployment process fails due to an unresolved module path in lightningcss, specifically pointing to the missing ../pkg module. This prevents the Serverless application from being deployed successfully.

Environment
  • OS: linux
  • Node Version: Node.js v20.10.0
  • Vite Version: ^5.1.5
  • lightningcss Version: ^1.24.0
  • Serverless Framework Version: "serverless": "^3.30.1",
    "serverless-esbuild": "^1.44.0",
  • Package Manager: npm
Attempts to Resolve
  • Reinstalled all project dependencies.
  • Directly installed @lightningcss/core.
  • Searched for similar issues in both Vite and lightningcss repositories and community forums.
  • Checked and attempted to adjust Serverless packaging configurations to bypass the issue.

None of the above steps have resolved the issue, which seems specific to the integration of Vite 5.0 and lightningcss in the context of Serverless deployments.

Additional Context

This issue is critically impacting our ability to deploy updates to our Serverless application. We rely on the Serverless Framework for deploying our application to AWS Lambda, and the current issue with lightningcss is blocking our deployment pipeline.

Any insights, workarounds, or fixes for this problem would be greatly appreciated. Thank you for your time and support.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with node_modules/lightningcss/node/index.js at line 16 and the referenced lightningcss node/index.js source, then reproduce the failure with the listed Vite, Serverless Framework, and serverless-esbuild versions using serverless deploy. Trace why ../pkg is unavailable during packaging and verify that the deployment completes without the unresolved-module error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, vite
Domain
build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.