Uncaught TypeError: Cannot read property '0' of undefined at Object.require.624../cjs/react-is.development.js
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react
- Ambito
- build-system, tooling
Direzione di ricerca
Inizia con lo script Browserify e i relativi output di factor-bundle, quindi riproduci il malfunzionamento usando l’import di recharts e il bundle a.js generato. Confronta i factor bundle generati con un normale bundle Browserify e ispeziona la sezione react-is intorno a arguments[4][722][0]; il lavoro è completato quando il bundle suddiviso viene caricato senza il TypeError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have some React components that I am bundling with browserify, and I decided to try out factor-bundle to split code between pages of my app. Here is the js file I have written to browserify with factor-bundle:
var browserify = require('browserify');
var fs = require('fs');
var pwd = './usr/local/www/documents/media/js/react/'
var dest = './usr/local/www/documents/media/js/browserified/'
var files = [ pwd + 'a.js', pwd + 'b.js' ];
var b = browserify(files);
b.plugin('factor-bundle', {
outputs: [ dest + 'a.js', dest + 'b.js']
});
b.bundle().pipe(fs.createWriteStream(dest + 'common.js'));
When importing that newly created a.js bundle into an HTML doc, I get the following error that crashes the React component:
Uncaught TypeError: Cannot read property '0' of undefined
at Object.require.624../cjs/react-is.development.js (eval at globalEval (jquery.min.js:2), <anonymous>:57741:18)
at s (eval at globalEval (jquery.min.js:2), <anonymous>:1:262)
at eval (eval at globalEval (jquery.min.js:2), <anonymous>:1:313)
at Object.require.615../DataUtils (eval at globalEval (jquery.min.js:2), <anonymous>:57426:16)
at s (eval at globalEval (jquery.min.js:2), <anonymous>:1:262)
at eval (eval at globalEval (jquery.min.js:2), <anonymous>:1:313)
at Object.require.579.../util/DataUtils (eval at globalEval (jquery.min.js:2), <anonymous>:52263:19)
at s (eval at globalEval (jquery.min.js:2), <anonymous>:1:262)
at eval (eval at globalEval (jquery.min.js:2), <anonymous>:1:313)
at Object.require.587../cartesian/Area (eval at globalEval (jquery.min.js:2), <anonymous>:37928:14)
The error is not very informative, but by removing some lines of code, I was able to find that the presence of the following line was causing the issue to appear:
import {Area, AreaChart, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from "recharts";
I am not sure to think that this issue has anything to do with recharts. If I browserify all my react code into a single bundle, I am able to import and use that bundle just fine. But if I import a.js with factor-bundle, this issue will appear.
Using the links given by the console log's error, the line that is failing looks something like this:
exports.parseChildIndex = parseChildIndex;
},{"./DataUtils":821,"./ShallowEqual":829,"lodash/flatten":650,"lodash/get":651,"lodash/isArray":656,"lodash/isNil":665,"lodash/isString":671,"react":757,"react-is":837}],837:[function(require,module,exports){
arguments[4][722][0].apply(exports,arguments)
},{"./cjs/react-is.development.js":835,"./cjs/react-is.production.min.js":836,"_process":710,"dup":722}],836:[function(require,module,exports){
....
Where the bolded [0] is what is marked as the breaking code. Not sure how or why this is happening, but using normal browserify does not cause this issue, which makes me think it has more to do with what's going on in factor-bundle than the recharts package.
I know this is an obscure issue. Any help would be appreciated because code-splitting would be very helpful for my app.
- Lingua principale
- JavaScript
- Stelle
- 397
- Fork
- 24
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserify/factor-bundle
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
browserify/factor-bundle#95 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
browserify/factor-bundle#92 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
browserify/factor-bundle#83 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
browserify/factor-bundle#82 · 3 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
browserify/factor-bundle#81 · 2 commenti ·
Tutte le issue di browserify/factor-bundle
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100
-
Issue-Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
sugarlabs/musicblocks#8924 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ArduPilot/ardupilot_wiki#8088 ·
-
[BUG] createTool tools cannot be registered with Mastra when exactOptionalPropertyTypes is enabled Apertacustomer-eng status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100