1

I git clone the web3j and found in the fold dist there are web3.js , web3.min.js, web3-light.js , web3-light.min.js

Whats the difference between web3.js , web3.min.js, web3-light.js , web3-light.min.js?

0

Short answer:

web3.js contains the bignumber.js module while web3-light.js does not.

min.js suffix means library is minified (code is unreadable) and compressed.

Long answer:

web3.js is open-source project, so lets see what's inside. Web3 use Gulp build system to produce different versions of library. The code responsible for light flavour looks like this:

gulp.task('light', ['clean'], function () {
    return browserify(browserifyOptions)
        .require('./' + src + '.js', {expose: 'web3'})
        .ignore('bignumber.js')
        .require('./lib/utils/browser-bn.js', {expose: 'bignumber.js'}) // fake bignumber.js
        .add('./' + src + '.js')
        .bundle()
        .pipe(exorcist(path.join( DEST, lightDst + '.js.map')))
        .pipe(source(lightDst + '.js'))
        .pipe(gulp.dest( DEST ))
        .pipe(streamify(uglify()))
        .pipe(rename(lightDst + '.min.js'))
        .pipe(gulp.dest( DEST ));
});

uglify() function is responsible for minification process. Generally, min version is use in production, while without min - in development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.