question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.parcelrc fails to extend @parcel/config-default - cannot find module

See original GitHub issue

🐛 bug report

I’m getting started with parcel in a brand new project with only a few files. I want to use tsc as the default Typescript compiler so I’m following instructions posted here: https://v2.parceljs.org/languages/typescript/#typescript’s-tsc

Once I added the .pacelrc parcel no longer complies. It now fails with the following error:

Error: Cannot find module '@parcel/config-default' from 'X:\projects\boomerang'
    at X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:116:35
    at processDirs (X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:269:39)
    at isdir (X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:276:32)
    at isDirectory (X:\projects\boomerang\boomerang-website\node_modules\@parcel\utils\lib\resolve.js:56:9) {
  code: 'MODULE_NOT_FOUND'
}

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

.parcelrc

{
  "extends": ["@parcel/config-default"],
  "transformers": {
    "*.{ts,tsx}": ["@parcel/transformer-typescript-tsc"]
  }
}

.package.json

{
  "name": "boomerang-website",
  "version": "1.0.0",
  "scripts": {
    "prestart": "npm run clean",
    "start": "npx parcel ./src/*.html",
    "clean": "npx rimraf ./dist",
    "prebuild": "npm run clean",
    "build": "npx parcel build ./src/*.html",
    "predeploy": "npm run build",
    "deploy": "sls deploy -v"
  },
  "devDependencies": {
    "parcel": "^2.0.0-beta.1",
    "rimraf": "^3.0.2"
  },
  "dependencies": {
    "serverless-cloudfront-invalidate": "^1.5.0",
    "serverless-s3-sync": "^1.15.0"
  }
}

🤔 Expected Behavior

Should resolve @parcel/config-default, the package exists.

😯 Current Behavior

Error: Cannot find module '@parcel/config-default' from 'X:\projects\boomerang'
    at X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:116:35
    at processDirs (X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:269:39)
    at isdir (X:\projects\boomerang\boomerang-website\node_modules\resolve\lib\async.js:276:32)
    at isDirectory (X:\projects\boomerang\boomerang-website\node_modules\@parcel\utils\lib\resolve.js:56:9) {
  code: 'MODULE_NOT_FOUND'
}

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel ^2.0.0-beta.1
Node v14.15.1
npm/Yarn npm@6.14.8
Operating System Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
mischniccommented, Jan 15, 2021

Make sure that parcel, @parcel/config-default and @parcel/validator-typescript are all on the same (or latest) nightly version.

But aside from that, should it be necessary to explicitly import @parcel/config-default? If so, shouldn’t that be in the documentation? I am willing to add it if that is the correct solution.

Yes, for example Yarn PnP would throw an error if you don’t list it in the dependencies. But I’m not quite sure how to put that into the docs without adding a note to every blue “example” block with a .parcelrc (or maybe that’s fine?)

3reactions
mischniccommented, Jan 6, 2021

You should install @parcel/config-default and @parcel/transformer-typescript-tsc as dependencies

Read more comments on GitHub >

github_iconTop Results From Across the Web

parcelrc fails to extend @parcel/config-default - cannot find ...
bug report. I'm getting started with parcel in a brand new project with only a few files. I want to use tsc as...
Read more >
Dependency resolution - Parcel
Parcel implements an enhanced version of the Node module resolution algorithm. It is responsible for turning a dependency specifier into an absolute path ......
Read more >
@parcel/config-default NPM | npm.io
Automatically transforms modules using Babel, PostCSS, and PostHTML when needed - even node_modules . ✂️ Zero configuration code splitting using dynamic ...
Read more >
parcel/core: Failed to resolve 'index.html' Getting this error
Generally, you'll want to add your custom resolvers before running the default ones. { "extends": "@parcel/config-default", "resolvers": [" ...
Read more >
Plugin Configuration - Parcel
A common usecase is extending the default config, for this reason the extends field can be a config package or an array of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found