seangenabe / browserify-breakdown Goto Github PK
View Code? Open in Web Editor NEWbreak down and analyze browserify/browser-pack bundles
break down and analyze browserify/browser-pack bundles
I'm attempting to examine a bundle of 79mb but I keep getting JavaScript heap out of memory
. I gave it 16gb of memory to work with but it wasn't enough. Is this normal or is something else going on?
browserify-breakdown < _dist/js/index.min.js
project/node_modules/browserify-breakdown/index.js:44
level: level,
^
ReferenceError: level is not defined
at walk (project/node_modules/browserify-breakdown/index.js:44:18)
at project/node_modules/browserify-breakdown/index.js:63:14
at Array.map (native)
at walk (project/node_modules/browserify-breakdown/index.js:62:28)
at project/node_modules/browserify-breakdown/index.js:63:14
at Array.map (native)
at walk (project/node_modules/browserify-breakdown/index.js:62:28)
at project/node_modules/browserify-breakdown/index.js:63:14
at Array.map (native)
at walk (project/node_modules/browserify-breakdown/index.js:62:28)
Using:
Can you add a repository field so it shows up? https://www.npmjs.com/package/browserify-breakdown
I usually don't trust packages that don't have a repo field, since it's too difficult to find the code. ;)
Great library, cheers!
$ npm install -g browserify-breakdown
$ browserify-breakdown
env: node\r: No such file or directory
If you convert the line endings to unix style, then this will start working for users on non-Windows systems, I believe. If you google for the error message, you can see how others resolved it. For example: nwutils/nw-builder#75
Unfortunately for me, on a Windows environment running:
Get-Content .\_Inc\0.common-factor.js | browserify-breakdown
Always throws an error:
SyntaxError: Error parsing regular expression: Invalid regular expression: /^-???[\d,]+.?\d*$/: Nothing to repeat (17153:11)
at Parser.pp$4.raise (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2488:13)
at tryCreateRegexp (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:3029:44)
at Parser.pp$7.readRegexp (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:3090:5)
at Parser.pp$7.readToken_slash (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2862:50)
at Parser.pp$7.getTokenFromCode (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2988:17)
at Parser.pp$7.readToken (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2733:15)
at Parser.pp$7.nextToken (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2724:13)
at Parser.pp$7.next (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2684:8)
at Parser.pp.eat (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:555:10)
at Parser.pp$3.parsePropertyValue (C:\Users\mike.dvorscak\AppData\Roaming\npm\node_modules\browserify-breakdown\node_modules\acorn\dist\acorn.js:2208:12)
I suspect that this is not a problem with acorn, but rather the encoding of the file when windows pipes it's contents to this script.
I might be able to avoid this whole thing by adding a gulp task to do this for me. I looked in the tests and it seems this library works with strings. Will it also work for streams? Maybe you could add some programmatic examples in the README (using gulp, using scripts).
$ npx browserify-breakdown < build/assets/discovery-0.1.0.js
npx: installed 40 in 8.712s
/npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:52
size: Buffer.byteLength(info[moduleId].source)
^
TypeError: Cannot read property 'source' of undefined
at walk (/npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:52:45)
at /npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:59:14
at Array.map (native)
at walk (/npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:58:28)
at /npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:59:14
at Array.map (native)
at walk (/npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:58:28)
at /npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:59:14
at Array.map (native)
at walk (/npm5-cache/_npx/8/lib/node_modules/browserify-breakdown/index.js:58:28)
it does work on the vendor.js
from the same project, though, which is built using a similar browserify configuration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.