Parcel: 馃悰 Could not statically evaluate fs call

Created on 5 Jan 2018  路  7Comments  路  Source: parcel-bundler/parcel

馃悰 bug report

馃帥 Configuration (.babelrc, package.json, cli command)

zero config

{
  "your": { "config": "here" }
}

馃 Expected Behavior


work

馃槸 Current Behavior

node_modules/options/lib/options.js: Could not statically evaluate fs call

at evaluate (/Users/victor/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:163:11)
    at CallExpression.path.get.map.arg (/Users/victor/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:21)
    at Array.map (<anonymous>)
    at JSAsset.CallExpression (/Users/victor/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:10)
    at NodePath._call (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/context.js:103:17)
    at TraversalContext.visit (/Users/victor/.config/yarn/global/node_modules/babel-traverse/lib/context.js:190:19)

馃拋 Possible Solution

馃敠 Context

馃捇 Code Sample

import Gdax from 'gdax'
const publicClient = new Gdax.PublicClient()

publicClient
  .getProducts()
  .then(data => {
    console.log(data)
  })
  .catch(error => {
    console.log(error)
  })

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.4.1
| Node | 9.3.0
| npm/Yarn | 1.3.2
| Operating System | macOS 10.13.3

Most helpful comment

@stychu if you want a temporary workaround you can edit node_modules/mime/package.json to add this :

{
  ...,
  "browser": {
    "fs": false
  }
}

It'll instruct Parcel to ignore all fs calls for this module.

All 7 comments

Asynchronous fs calls are currently not supported

I also got the problem.

馃毃  /Users/tomoki/repos/portfolio/coin_now_client/node_modules/mime/mime.js: Could not statically evaluate fs call
    at evaluate (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:163:11)
    at CallExpression.path.get.map.arg (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:21)
    at Array.map (<anonymous>)
    at JSAsset.CallExpression (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:10)
    at NodePath._call (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitSingle (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/context.js:108:19)
    at TraversalContext.visit (/Users/tomoki/dotfiles/.config/yarn/global/node_modules/babel-traverse/lib/context.js:192:19)

parcel: 1.4.1
node: 8.9.3
yarn: 1.3.2

I also got the problem.

馃毃  /Users/zhoulijie/Documents/workspace/2017/11/parcel-test/node_modules/xlsx/xlsx.js: Could not statically evaluate fs call
    at evaluate (/Users/zhoulijie/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:163:11)
    at CallExpression.path.get.map.arg (/Users/zhoulijie/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:21)
    at Array.map (<anonymous>)
    at JSAsset.CallExpression (/Users/zhoulijie/.config/yarn/global/node_modules/parcel-bundler/src/visitors/fs.js:30:10)
    at NodePath._call (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/context.js:103:17)
    at TraversalContext.visit (/Users/zhoulijie/.config/yarn/global/node_modules/babel-traverse/lib/context.js:190:19)

parcel: 1.4.1
node: 8.9.3
yarn: 1.3.2

I just got this with 1.6.0 trying to import hostile with node 9.

Got this also. node 9.5.0 parcel 1.6.2
node_modules/mime/mime.js:52:32: Cannot statically evaluate fs argument

```51 | var map = {},

52 | content = fs.readFileSync(file, 'ascii'),
| ^
53 | lines = content.split(/[\r\n]+/);
54 |
55 | lines.forEach(function(line) {
```

Is there a fix for this ?

@stychu if you want a temporary workaround you can edit node_modules/mime/package.json to add this :

{
  ...,
  "browser": {
    "fs": false
  }
}

It'll instruct Parcel to ignore all fs calls for this module.

@stychu if you want a temporary workaround you can edit node_modules/mime/package.json to add this :

{
  ...,
  "browser": {
    "fs": false
  }
}

It'll instruct Parcel to ignore all fs calls for this module.

In my case, doesn't fix it. Why happens it this?

Was this page helpful?
0 / 5 - 0 ratings