Comments (5)
Adding:
node: {
fs: 'empty'
},
to my webpack config seems to make the error go away.
from jq-web.
For people that use CRA (create react app), resulting in a v5 React project that uses react-scripts
to run and build your app - the lack of polyfilled fs
and path
modules will cause issues for you.
To get around this, you can use react-app-rewired
to run and build your project, which will allow you to create a config-overrides.js
file, and supply fallback configuration like so:
module.exports = function override (config, env) {
let loaders = config.resolve
loaders.fallback = {
"fs": false,
"path": require.resolve("path-browserify"),
}
return config
}
And then when running you're app, just replace the original react-scripts reference:
/* package.json */
"scripts": {
- "start": "react-scripts start",
+ "start": "react-app-rewired start",
- "build": "react-scripts build",
+ "build": "react-app-rewired build",
- "test": "react-scripts test",
+ "test": "react-app-rewired test",
"eject": "react-scripts eject"
}
from jq-web.
I believe the emscripten runtime will try require
ing fs
but if it is not there then it will use the in-memory filesystem. On Browserify I believe there's a default empty fs
, so I've never saw that error.
Thank you for solving the problem for Webpack users. I should add this to the usage instructions.
Ok, I've added a note about it, but I don't actually know anything about Webpack, so I've linked to this issue: aaf5996 (if you think this should be improved somehow, please let me know or send a PR).
from jq-web.
For anyone else, like me, hitting this error from inside NextJS
(which uses Webpack 5 by default), I was able to fix it by following this comment, and putting the relevent configuration in my next.config.js
: vercel/next.js#7755 (comment)
Thanks! :)
from jq-web.
On webpack 5, this package tries to load a few node dependencies:
- crypto
- path
- fs
Do you know whether excluding crypto
, for example, could cause issues?
from jq-web.
Related Issues (20)
- jq version? HOT 2
- Cannot access full jq error details HOT 3
- If invalid JSON is passed to jq.promised.raw all future runs an empty string HOT 3
- jq flags `-r` effect seems can't cancel between calls ? HOT 11
- jq-web module suddenly stops working HOT 1
- todate doesn't work in chrome extension. HOT 5
- Unclosed streams caused FS error after calling jq.json 2048 times. HOT 4
- v0.5.1 fails on any JQ expression containing "%" operator HOT 2
- How to write to pathes? Missing documentation
- Library uses very large amounts of storage HOT 1
- Include TypeScript types HOT 1
- Failure to include jq files HOT 1
- Error message gets cut off when parsing a malformed date
- Project dead? HOT 1
- Upgrade path for jq 1.7 HOT 3
- Intermittent `<generic error, no stack>` exception using jq.promised.json
- `Unexpected end of JSON input` from `jq.promised.json` if no result set produced
- jq-web no longer builds with modern emscripten. HOT 3
- Sync function HOT 5
- Add jq options HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jq-web.