parcel: Basic .parcelrc crashes Parcel
Using the following .parcelrc
crashes the latest alpha release 2.0.0-alpha.2.1
.
{
"extends": "@parcel/config-default",
"transforms": {
"*.js": ["@parcel/transformer-babel"]
}
}
Error thrown:
🚨 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 / parcel@2.0.0-alpha.2.1 / node@12.2.0 / yarn@1.19.1
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 21 (3 by maintainers)
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:For me, it seems like updating from beta-3.1 to the latest nightly (2.0.0-nightly.688) fixed the issue.
I have this issue in the latest nightlies of Parcel 2. Not in the alpha/beta.
Adding
--no-scope-hoisting
to the build command fixes but is not ideal.My .parcelrc looks like this:
using
@hegner123 in your case, it’s because you’re using
@babel/preset-env
instead of@parcel/babel-preset-env
(https://v2.parceljs.org/languages/babel/#extending-the-default-babel-config), which is bad for bundle size anyway.The underlying problem is that using require instead of ESM imports for css files is broken (and in this case, Babel transpiles
import "./App.css"
into require). Does that explain/help fix the error for anyone else as well?I seem to be having the same behaviour as well using latest nightlies as well as
beta-3.1
.With or without a
.parcelrc
I still get the same error. Adding--no-scope-hoist
also appears to be the only workaround I can currently find.(I’m leaving this ticket open because of
The only thing we can do here is give a better error message
.)