Parcel: Basic .parcelrc crashes Parcel

Created on 25 Oct 2019  Â·  4Comments  Â·  Source: parcel-bundler/parcel

Using the following .parcelrc crashes the latest alpha release 2.0.0-alpha.2.1.

~json
{
"extends": "@parcel/config-default",
"transforms": {
"*.js": ["@parcel/transformer-babel"]
}
}
~

Error thrown:

~~~shell
🚨 The expression evaluated to a falsy value:

(0, _assert.default)(typeof v === 'string')

(0, _assert.default)(typeof v === 'string')

at assertString (/home/romu/tmp/parcel-ssr/node_modules/@parcel/scope-hoisting/lib/link.js:47:23)
at /home/romu/tmp/parcel-ssr/node_modules/@parcel/scope-hoisting/lib/link.js:89:16
at enter (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:475:16)
at enter (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:475:16)
at enter (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:475:16)
at walk (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:310:26)
at walk (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:331:22)
at Graph.dfs (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:355:12)
at Graph.traverse (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:257:17)
at Graph.filteredTraverse (/home/romu/tmp/parcel-ssr/node_modules/@parcel/core/lib/Graph.js:265:17)

~~~

Repro: https://github.com/brillout/parcel-ssr

Context: I want to build an SSR tool on top of Parcel.

Env: Linux / [email protected] / [email protected] / [email protected]

Bug ✨ Parcel 2

Most helpful comment

Using scopehoisting requires that "@parcel/transformer-js" transforms the assets (and set some metadata). The only thing we can do here is give a better error message. You should use a Ëš.parcelrc` like this one:

{
  "extends": "@parcel/config-default",
  "transforms": {
    "*.js": ["@parcel/transformer-babel", "@parcel/transformer-js"]
  }
}

I too got the error The expression evaluated to a falsy value and tried to add this as my .parcelrc, but it doesn't work:

{ [Error: Invalid Parcel Config]
  diagnostics:
   [ { message: 'Invalid Parcel Config',
       origin: '@parcel/core',
       filePath: '.parcelrc',
       language: 'json',
       codeFrame: [Object] } ],
  name: 'Error' }

All 4 comments

Using scopehoisting requires that "@parcel/transformer-js" transforms the assets (and set some metadata). The only thing we can do here is give a better error message. You should use a Ëš.parcelrc` like this one:

{
  "extends": "@parcel/config-default",
  "transforms": {
    "*.js": ["@parcel/transformer-babel", "@parcel/transformer-js"]
  }
}

Thanks it works now.

(I'm leaving this ticket open because of The only thing we can do here is give a better error message.)

Using scopehoisting requires that "@parcel/transformer-js" transforms the assets (and set some metadata). The only thing we can do here is give a better error message. You should use a Ëš.parcelrc` like this one:

{
  "extends": "@parcel/config-default",
  "transforms": {
    "*.js": ["@parcel/transformer-babel", "@parcel/transformer-js"]
  }
}

I too got the error The expression evaluated to a falsy value and tried to add this as my .parcelrc, but it doesn't work:

{ [Error: Invalid Parcel Config]
  diagnostics:
   [ { message: 'Invalid Parcel Config',
       origin: '@parcel/core',
       filePath: '.parcelrc',
       language: 'json',
       codeFrame: [Object] } ],
  name: 'Error' }
Was this page helpful?
0 / 5 - 0 ratings

Related issues

will-stone picture will-stone  Â·  3Comments

davidnagli picture davidnagli  Â·  3Comments

mnn picture mnn  Â·  3Comments

philipodev picture philipodev  Â·  3Comments

termhn picture termhn  Â·  3Comments