mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-19 21:07:18 +00:00

For some strange reason, Browserify will hardcode absolute paths from the machine that generated the bundle to be able to resolve `__dirname` and `__filename` calls. This makes no sense, given that it means that the Browserify bundle will not work when we move it to another machine, which went undetected probably for months. The Browserify community apparently makes modules to fix this particular issue (like `bundle-collapser`, and `intreq`), however none of this seem to solve the problem for the Etcher CLI bundle. I also gave https://github.com/zeit/pkg a go, however I gave up after not being able to make use of native modules (nothing seems to work; the packager result will simply not find the addons). Finally, I ended up making the following workarounds: - Edit the Browserify bundle file to use its own `__dirname` to dynamically resolve the values of `__dirname` and `__filename` of the files it contains - Patch `lzma-native` to statically require its add-on rather than relying on dynamic requires from `node-pre-gyp`, which makes it impossible to resolve on the final bundle See: https://github.com/resin-io/etcher/issues/355 See: http://stackoverflow.com/questions/21993073/browserify-with-paths-to-folders-in-my-system Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
40 lines
760 B
Plaintext
40 lines
760 B
Plaintext
# Javascript files must retain LF line-endings (to keep eslint happy)
|
|
*.js text eol=lf
|
|
# CSS and SCSS files must retain LF line-endings (to keep ensure-staged-sass.sh happy)
|
|
*.css text eol=lf
|
|
*.scss text eol=lf
|
|
|
|
# Text files
|
|
dictionary text
|
|
Dockerfile* text
|
|
.dockerignore text
|
|
.editorconfig text
|
|
etcher text
|
|
.git* text
|
|
*.html text
|
|
*.json text
|
|
*.cpp text
|
|
*.h text
|
|
*.gyp text
|
|
LICENSE text
|
|
Makefile text
|
|
*.md text
|
|
*.sh text
|
|
*.bat text
|
|
*.svg text
|
|
*.yml text
|
|
*.patch text
|
|
|
|
# Binary files (no line-ending conversions)
|
|
*.bz2 binary diff=hex
|
|
*.gz binary diff=hex
|
|
*.icns binary diff=hex
|
|
*.ico binary diff=hex
|
|
*.img binary diff=hex
|
|
*.iso binary diff=hex
|
|
*.png binary diff=hex
|
|
*.xz binary diff=hex
|
|
*.zip binary diff=hex
|
|
*.dmg binary diff=hex
|
|
*.rpi-sdcard binary diff=hex
|