parcel: fs.readFileSync - Cannot statically evaluate fs argument
π bug report
π Configuration (.babelrc, package.json, cli command)
{
"your": { "config": "here" }
}
π€ Expected Behavior
π― Current Behavior
π Possible Solution
π¦ Context
π» Code Sample
https://github.com/mytee306/marked-intro
π Your Environment
Software | Version(s) |
---|---|
Parcel | latest |
Node | latest |
npm/Yarn | latest |
Operating System | linux mint |
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 4
- Comments: 21 (6 by maintainers)
just tell parcel youβre running in a node environment with the
target
flage.g.
parcel app.js --target node
@codeshifu That is all it takes!
Iβll change this into a feature request as
require.resolve
should probably be supported as itβs pretty much what parcel currently does (without adding it explicitly).However
process.cwd()
can not really be statically evaluated (at least not reliable).Apologies if Iβve misread anything, went over this thread rather quickly.
@mytee306 Oh! Now this is something that can be improved I think. Parcel should be able to evaluate
require.resolve
calls statically. Then piping it intofs.readFileSync
should make that work too. Maybe modify the issue or create a new one to address this?You did this:
Just do this: