Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch mode issue with webextension : Cannot read properties of undefined (reading 'flatMap') #9335

Closed
Booteille opened this issue Oct 23, 2023 · 0 comments · Fixed by #9341
Closed

Comments

@Booteille
Copy link

🐛 bug report

Hi!

After upgrading Parcel to the latest version (2.10.0), when building my Web Extension using parcel build command, everything works fine but using the watch mode returns an error.

This one works:

$ yarn parcel build manifest.json --config @parcel/config-webextension --target webext-dev

This one returns the following error:

$ yarn parcel manifest.json --config @parcel/config-webextension --target webext-dev
yarn run v1.22.19
$ /home/booteille/Dev/peertube-companion/node_modules/.bin/parcel manifest.json --config @parcel/config-webextension --target webext-dev
Server running at http://localhost:1234
🚨 Build failed.

@parcel/transformer-webextension: Cannot read properties of undefined (reading 'flatMap')

  TypeError: Cannot read properties of undefined (reading 'flatMap')
      at collectDependencies
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/transformer-webextension/lib/WebExtensionTransformer.js:290:59)
      at async Object.transform
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/transformer-webextension/lib/WebExtensionTransformer.js:365:5)
      at async Transformation.runTransformer
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/Transformation.js:568:5)
      at async Transformation.runPipeline
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/Transformation.js:346:36)
      at async Transformation.runPipelines
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/Transformation.js:229:40)
      at async Transformation.run
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/Transformation.js:149:21)
      at async Object.run
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/requests/AssetRequest.js:102:7)
      at async RequestTracker.runRequest
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/RequestTracker.js:637:20)
      at async AssetGraphBuilder.runAssetRequest
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/core/lib/requests/AssetGraphRequest.js:346:18)
      at async $31bd78e367586e0a$export$2e2bcd8739ae039._runFn
  (/home/booteille/Dev/peertube-companion/node_modules/@parcel/utils/lib/index.js:34236:13)

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

{
  "name": "peertube-companion",
  "version": "0.3.1",
  "description": "The PeerTube Companion",
  "author": "Booteille <booteille@protonmail.com>",
  "license": "CC BY-SA 4.0",
  "private": true,
  "scripts": {
    "build:dev": "yarn clean && parcel build manifest.json --config @parcel/config-webextension --target webext-dev",
    "build:prod": "yarn clean && parcel build manifest.json --config @parcel/config-webextension --target webext-prod && yarn zip",
    "clean": "rimraf .parcel-cache dist",
    "lint": "eslint --ext .ts,.tsx,.vue src",
    "test": "jest",
    "watch": "yarn clean && parcel manifest.json --config @parcel/config-webextension --target webext-dev",
    "zip": "cd dist/webext-prod && bestzip peertube-companion.zip *",
    "zip:sources": "zip -r dist/peertube-companion-sources.zip ./ -x \"./node_modules/*\" \"./.git/*\" \"./.parcel-cache/*\" \"./dist/*\""
  },
  "targets": {
    "webext-dev": {
      "sourceMap": {
        "inline": true,
        "inlineSources": true
      }
    },
    "webext-prod": {}
  },
  "dependencies": {
    "yarn": "^1.22.19"
  },
  "devDependencies": {
    "@fortawesome/fontawesome-svg-core": "6.4.2",
    "@fortawesome/free-regular-svg-icons": "6.4.2",
    "@fortawesome/free-solid-svg-icons": "6.4.2",
    "@fortawesome/vue-fontawesome": "3.0.3",
    "@parcel/config-webextension": "2.10.0",
    "@parcel/core": "2.10.0",
    "@parcel/optimizer-data-url": "2.10.0",
    "@parcel/transformer-inline-string": "2.10.0",
    "@parcel/transformer-typescript-tsc": "2.10.0",
    "@parcel/transformer-vue": "2.10.0",
    "@peertube/peertube-types": "5.2.0",
    "@types/download": "8.0.4",
    "@types/lodash.clonedeep": "^4.5.7",
    "@types/lodash.defaultsdeep": "^4.6.7",
    "@types/lodash.get": "4.4.8",
    "@types/lodash.set": "^4.3.7",
    "@types/webextension-polyfill": "0.10.5",
    "@typescript-eslint/eslint-plugin": "6.8.0",
    "@typescript-eslint/parser": "6.8.0",
    "@vue/eslint-config-prettier": "^8.0.0",
    "@vue/eslint-config-typescript": "12.0.0",
    "bestzip": "2.2.1",
    "eslint": "8.52.0",
    "eslint-config-standard-with-typescript": "39.1.1",
    "eslint-plugin-import": "2.29.0",
    "eslint-plugin-n": "^16.0.2",
    "eslint-plugin-node": "11.1.0",
    "eslint-plugin-promise": "6.1.1",
    "eslint-plugin-vue": "9.17.0",
    "lodash.clonedeep": "^4.5.0",
    "lodash.defaultsdeep": "^4.6.1",
    "lodash.get": "4.4.2",
    "lodash.set": "4.3.2",
    "parcel": "2.10.0",
    "prettier": "3.0.3",
    "prettier-eslint": "16.1.1",
    "rimraf": "5.0.5",
    "ts-results": "^3.3.0",
    "typescript": "5.2.2",
    "vue": "3.3.6",
    "vue-eslint-parser": "9.3.2",
    "vue-tsc": "1.8.19",
    "vue3-popper": "1.5.0",
    "webextension-polyfill": "0.10.0"
  }
}

🤔 Expected Behavior

I expected parcel to work in watch mode too in this context.

😯 Current Behavior

Actually, parcel does not compile the webextension in watchmode.

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.10.0
Node 20.8.1
npm/Yarn 4.0.0
Operating System Pop_OS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants