medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Webpack build error after updating

Open samhenderson511 opened this issue 1 year ago • 3 comments

Bug report

Describe the bug

After upgrading to 1.20, I'm seeing build errors from the admin package

System information

Medusa version (including plugins):

    "@medusajs/admin": "^7.1.10",
    "@medusajs/cache-inmemory": "^1.8.10",
    "@medusajs/cache-redis": "^1.9.0",
    "@medusajs/event-bus-local": "^1.9.7",
    "@medusajs/event-bus-redis": "^1.8.10",
    "@medusajs/file-local": "^1.0.2",
    "@medusajs/icons": "^1.1.0",
    "@medusajs/medusa": "^1.20.0",
    "@medusajs/medusa-cli": "^1.3.22",
    "@medusajs/ui": "^2.2.4",
    "@medusajs/utils": "^1.11.3",

Node.js version: 18 on prod, 20 on local, same result Database: postgres Operating system: MacOS 14.2.1

Steps to reproduce the behavior

  1. Update to 1.20.0
  2. run yarn
  3. run yarn build

Screenshots


> [email protected] build:server
> tsc -p tsconfig.json


> [email protected] build:admin
> medusa-admin build --deployment


● Webpack █████████████████████████ sealing (92%)  
 asset processing

4:42:16 PM [@medusajs/admin] caused by plugins in Compilation.hooks.processAssets
Error: 
  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5778:1]
 5778 │             },
 5779 │         },
 5780 │         handler: handlerP(getCommandHandler(`migrate`, (args, cmd) => {
 5781 │             "production" = "production" || 0;
      ·             ────────────
 5782 │             return cmd(args);
 5783 │         })),
 5784 │     })
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5799:1]
 5799 │                 : `Set port. Defaults to ${defaultPort}`,
 5800 │         }),
 5801 │         handler: handlerP(getCommandHandler(`develop`, (args, cmd) => {
 5802 │             "production" = "production" || 0;
      ·             ────────────
 5803 │             cmd(args);
 5804 │             // Return an empty promise to prevent handlerP from exiting early.
 5805 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5824:1]
 5824 │                 : `Set port. Defaults to ${defaultPort}`,
 5825 │         }),
 5826 │         handler: handlerP(getCommandHandler(`start`, (args, cmd) => {
 5827 │             "production" = "production" || 0;
      ·             ────────────
 5828 │             cmd(args);
 5829 │             // Return an empty promise to prevent handlerP from exiting early.
 5830 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5856:1]
 5856 │             describe: "Set number of cpus to use. Defaults to max number of cpus available on the system (set by env.CPUS)",
 5857 │         }),
 5858 │         handler: handlerP(getCommandHandler(`start-cluster`, (args, cmd) => {
 5859 │             "production" = "production" || 0;
      ·             ────────────
 5860 │             cmd(args);
 5861 │             // Return an empty promise to prevent handlerP from exiting early.
 5862 │             // The development server shouldn't ever exit until the user directly
      ╰────


Caused by:
    0: failed to parse input file
    1: Syntax Error
HookWebpackError: 
  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5778:1]
 5778 │             },
 5779 │         },
 5780 │         handler: handlerP(getCommandHandler(`migrate`, (args, cmd) => {
 5781 │             "production" = "production" || 0;
      ·             ────────────
 5782 │             return cmd(args);
 5783 │         })),
 5784 │     })
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5799:1]
 5799 │                 : `Set port. Defaults to ${defaultPort}`,
 5800 │         }),
 5801 │         handler: handlerP(getCommandHandler(`develop`, (args, cmd) => {
 5802 │             "production" = "production" || 0;
      ·             ────────────
 5803 │             cmd(args);
 5804 │             // Return an empty promise to prevent handlerP from exiting early.
 5805 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5824:1]
 5824 │                 : `Set port. Defaults to ${defaultPort}`,
 5825 │         }),
 5826 │         handler: handlerP(getCommandHandler(`start`, (args, cmd) => {
 5827 │             "production" = "production" || 0;
      ·             ────────────
 5828 │             cmd(args);
 5829 │             // Return an empty promise to prevent handlerP from exiting early.
 5830 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5856:1]
 5856 │             describe: "Set number of cpus to use. Defaults to max number of cpus available on the system (set by env.CPUS)",
 5857 │         }),
 5858 │         handler: handlerP(getCommandHandler(`start-cluster`, (args, cmd) => {
 5859 │             "production" = "production" || 0;
      ·             ────────────
 5860 │             cmd(args);
 5861 │             // Return an empty promise to prevent handlerP from exiting early.
 5862 │             // The development server shouldn't ever exit until the user directly
      ╰────


Caused by:
    0: failed to parse input file
    1: Syntax Error
    at makeWebpackError (/Users/[...]/node_modules/webpack/lib/HookWebpackError.js:48:9)
    at /Users/[...]/node_modules/webpack/lib/Compilation.js:3068:12
    at eval (eval at create (/Users/[...]/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:55:1)
-- inner error --
Error: 
  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5778:1]
 5778 │             },
 5779 │         },
 5780 │         handler: handlerP(getCommandHandler(`migrate`, (args, cmd) => {
 5781 │             "production" = "production" || 0;
      ·             ────────────
 5782 │             return cmd(args);
 5783 │         })),
 5784 │     })
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5799:1]
 5799 │                 : `Set port. Defaults to ${defaultPort}`,
 5800 │         }),
 5801 │         handler: handlerP(getCommandHandler(`develop`, (args, cmd) => {
 5802 │             "production" = "production" || 0;
      ·             ────────────
 5803 │             cmd(args);
 5804 │             // Return an empty promise to prevent handlerP from exiting early.
 5805 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5824:1]
 5824 │                 : `Set port. Defaults to ${defaultPort}`,
 5825 │         }),
 5826 │         handler: handlerP(getCommandHandler(`start`, (args, cmd) => {
 5827 │             "production" = "production" || 0;
      ·             ────────────
 5828 │             cmd(args);
 5829 │             // Return an empty promise to prevent handlerP from exiting early.
 5830 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5856:1]
 5856 │             describe: "Set number of cpus to use. Defaults to max number of cpus available on the system (set by env.CPUS)",
 5857 │         }),
 5858 │         handler: handlerP(getCommandHandler(`start-cluster`, (args, cmd) => {
 5859 │             "production" = "production" || 0;
      ·             ────────────
 5860 │             cmd(args);
 5861 │             // Return an empty promise to prevent handlerP from exiting early.
 5862 │             // The development server shouldn't ever exit until the user directly
      ╰────


Caused by:
    0: failed to parse input file
    1: Syntax Error
caused by plugins in Compilation.hooks.processAssets
Error: 
  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5778:1]
 5778 │             },
 5779 │         },
 5780 │         handler: handlerP(getCommandHandler(`migrate`, (args, cmd) => {
 5781 │             "production" = "production" || 0;
      ·             ────────────
 5782 │             return cmd(args);
 5783 │         })),
 5784 │     })
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5799:1]
 5799 │                 : `Set port. Defaults to ${defaultPort}`,
 5800 │         }),
 5801 │         handler: handlerP(getCommandHandler(`develop`, (args, cmd) => {
 5802 │             "production" = "production" || 0;
      ·             ────────────
 5803 │             cmd(args);
 5804 │             // Return an empty promise to prevent handlerP from exiting early.
 5805 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5824:1]
 5824 │                 : `Set port. Defaults to ${defaultPort}`,
 5825 │         }),
 5826 │         handler: handlerP(getCommandHandler(`start`, (args, cmd) => {
 5827 │             "production" = "production" || 0;
      ·             ────────────
 5828 │             cmd(args);
 5829 │             // Return an empty promise to prevent handlerP from exiting early.
 5830 │             // The development server shouldn't ever exit until the user directly
      ╰────

  × The left-hand side of an assignment expression must be a variable or a property access.
      ╭─[5856:1]
 5856 │             describe: "Set number of cpus to use. Defaults to max number of cpus available on the system (set by env.CPUS)",
 5857 │         }),
 5858 │         handler: handlerP(getCommandHandler(`start-cluster`, (args, cmd) => {
 5859 │             "production" = "production" || 0;
      ·             ────────────
 5860 │             cmd(args);
 5861 │             // Return an empty promise to prevent handlerP from exiting early.
 5862 │             // The development server shouldn't ever exit until the user directly
      ╰────

samhenderson511 avatar Jan 14 '24 16:01 samhenderson511

@kasperkristensen - do you have an idea what this might be?

srindom avatar Jan 18 '24 09:01 srindom

i have the same issue, very frustrating in the last 2 days, very very wasting time & energy.

volfadar avatar Jan 24 '24 15:01 volfadar

This solved the problem for me: https://docs.medusajs.com/troubleshooting/admin-webpack-build-types

pjrobot avatar Feb 20 '24 21:02 pjrobot

Hey, thanks for the report! Since v2 brought a lot of architectural and API changes on the backend, we will be closing this ticket since it no longer applies to our new setup, or the issue has already been fixed. If you are still facing issues with v1, please open a new ticket and we will address it as soon as possible. Thanks! 🙏

sradevski avatar Jul 05 '24 11:07 sradevski