You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'm trying to bundle same code on windows and ubuntu, and use gulp-uglify to compress the output files. Most of the output files are identical (with the same checksum) but only one is different. Don't know if browserify has any guarantees for this kind of cross-platform consistency, but it might be an issue worth looking into.
Below is a minimal POC that I've found by constantly trying. My project relies on echarts@^4.2.1, and uses gulp to run browserify to generate the bundle and finally compress it through gulp-uglify. In most cases this process will produce the same files on different platforms (at least in my current project).
The output is the same on Ubuntu and macOS, but not on Windows. The difference is only some digital labels (causing inconsistent order of modules):
From what I've tried, echarts/lib/component/axis/AxisView is causing this inconsistency. However, if I add bundle.require('echarts/lib/component/axis/AxisView'); after line 10 of gulpfile.js, the output becomes consistent.
Below is the content of gulpfile.js. All files are available in zip archives.
constgulp=require('gulp');constbrowserify=require('browserify');constsource=require('vinyl-source-stream');constuglify=require('gulp-uglify');constrev=require('gulp-rev');functionbuildMain(){letbundle=browserify({entries: './main.js',});// uncomment next line the output will be consistent.// bundle.require('echarts/lib/component/axis/AxisView');returnbundle.bundle().pipe(source('main.js')).pipe(gulp.dest('./bundle'));}gulp.task('build',gulp.series(buildMain,(done)=>{returngulp.src(`./bundle/*.js`).pipe(uglify()).pipe(rev()).pipe(gulp.dest(`./dist/scripts`)).pipe(rev.manifest()).pipe(gulp.dest('./bundle'));}));
main.js has only one line:
require('echarts/lib/component/axis/AxisView');
Environment:
Node version: 16.14.2 on all platforms, installed via nvm and nvm-windows.
OS version: Windows 11, Ubuntu 20.04 and macOS 12.3.
npm version: 8.5.5 on all platforms.
The text was updated successfully, but these errors were encountered:
Hi there, I'm trying to bundle same code on windows and ubuntu, and use gulp-uglify to compress the output files. Most of the output files are identical (with the same checksum) but only one is different. Don't know if browserify has any guarantees for this kind of cross-platform consistency, but it might be an issue worth looking into.
Below is a minimal POC that I've found by constantly trying. My project relies on echarts@^4.2.1, and uses gulp to run browserify to generate the bundle and finally compress it through gulp-uglify. In most cases this process will produce the same files on different platforms (at least in my current project).
browserify-gulp-example.zip
The output is the same on Ubuntu and macOS, but not on Windows. The difference is only some digital labels (causing inconsistent order of modules):
From what I've tried,
echarts/lib/component/axis/AxisView
is causing this inconsistency. However, if I addbundle.require('echarts/lib/component/axis/AxisView');
after line 10 ofgulpfile.js
, the output becomes consistent.Below is the content of
gulpfile.js
. All files are available in zip archives.main.js
has only one line:Environment:
The text was updated successfully, but these errors were encountered: