parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.46k stars 2.27k forks source link

Invalid regular expression - Invalid property name in character class #9125

Closed chdominguez closed 1 year ago

chdominguez commented 1 year ago

🐛 bug report

Cannot build in Rocky Linux. I have a project which builds perfectly on macOS and Ubuntu but when running parcel build in Rocky Linux 8 (with exactly the same configuration) I obtain a Invalid regular expression (details below) error which does not let me build the code. I tried the fix proposed at #2316 but neither adding <meta charset="UTF-8" /> nor disabling optimization solves the issue.

🎛 Configuration (.babelrc, package.json, cli command)

Package.json deps

{
  "dependencies": {
    "@dnd-kit/core": "^6.0.8",
    "@dnd-kit/modifiers": "^6.0.1",
    "@dnd-kit/sortable": "^7.0.2",
    "@headlessui/react": "^1.7.14",
    "@heroicons/react": "^2.0.18",
    "animejs": "^3.2.1",
    "bootstrap": "^5.2.3",
    "eslint": "^8.42.0",
    "i18next": "^22.4.15",
    "i18next-browser-languagedetector": "^7.0.1",
    "immutability-helper": "^3.1.1",
    "molstar": "^3.34.0",
    "react": "^18.2.0",
    "react-bootstrap": "^2.7.4",
    "react-console-emulator": "^5.0.2",
    "react-dnd": "^16.0.1",
    "react-dnd-html5-backend": "^16.0.1",
    "react-dom": "^18.2.0",
    "react-i18next": "^12.2.2",
    "react-loader-spinner": "^5.3.4",
    "react-resizable-panels": "^0.0.51",
    "react-router": "^6.11.2",
    "react-router-dom": "^6.11.2",
    "react-xarrows": "^2.0.2",
    "socket.io": "^4.6.1",
    "socket.io-client": "^4.6.1",
    "styled-components": "^5.3.10"
  },
  "devDependencies": {
    "@parcel/transformer-sass": "^2.8.3",
    "autoprefixer": "^10.4.14",
    "buffer": "^5.7.1",
    "parcel": "^2.8.3",
    "postcss": "^8.4.23",
    "prettier": "2.8.8",
    "process": "^0.11.10",
    "run-script-os": "^1.1.6",
    "tailwindcss": "^3.3.2"
  }
}

CLI command:

npx parcel build Views/**/*.html --dist-dir GUI

🤔 Expected Behavior

Frontend files should build without issue.

😯 Current Behavior

The compilation process fails with the following error:

🚨 Build failed.

Error: Invalid regular expression: /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/: Invalid property name in character class

  /home/cdominguez/Desktop/Developer/horus/node_modules/@parcel/packager-js/lib/ScopeHoistingPackager.js:65
  const IDENTIFIER_RE = /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  SyntaxError: Invalid regular expression: /^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/: Invalid property name in character class
      at internalCompileFunction (node:internal/vm:73:18)
      at wrapSafe (node:internal/modules/cjs/loader:1176:20)
      at Module._compile (node:internal/modules/cjs/loader:1218:27)
      at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
      at Module.load (node:internal/modules/cjs/loader:1117:32)
      at NodePackageManager.load (/home/cdominguez/Desktop/Developer/horus/node_modules/@parcel/package-manager/lib/index.js:3423:15)
      at NodePackageManager.requireSync (/home/cdominguez/Desktop/Developer/horus/node_modules/@parcel/package-manager/lib/index.js:3395:21)
      at m.require (/home/cdominguez/Desktop/Developer/horus/node_modules/@parcel/package-manager/lib/index.js:3410:25)
      at require (node:internal/modules/cjs/helpers:110:18)
      at Object.<anonymous> (/home/cdominguez/Desktop/Developer/horus/node_modules/@parcel/packager-js/lib/index.js:43:30)

💁 Possible Solution

No solution found yet.

🔦 Context

Cannot build my project in this specific linux machine because of this.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.9.3
Node v18.16.0
npm/Yarn 9.5.1
Operating System Linux 4.18.0-348.el8.0.2.x86_64 GNU/Linux
chdominguez commented 1 year ago

Apparently it got fixed by upgrading NodeJS to 18.6.1