I have a simple hello world script main.js:
window.addEventListener('load', function() {
"use strict";
document.getElementById('output').textContent = "Hello, browser.";
});
If I build bundle.js with:
browserify -r ./main.js > bundle.js
It doesn't run in the browser. No errors, just doesn't execute. If I use:
browserify -r --debug ./main.js > bundle.js
It runs fine. Why doesn't the non-debug one run?
-r
means require. ->-r file.js
means, that you will put it into a seperate scope to require it in an other bundle, but it don't will execute.Your "solution"
-r --debug
(or short-r -d
) works, because therequire
attribute has no parameter/file, so it will be ignored by browserify.This...
...is the same as this: