Closed armandabric closed 7 years ago
+1
+1
I get the same error.
Digging into it, there are a couple things at play.
Needs v1.x so you can do:
browser-unpack < bundle.vendor.js
<1.0 will output "couldn't parse this bundle".
As far as I can tell, browserify does not support both --full-paths
with --require
Demo:
$ browserify --full-paths --require "hello-world-js" > bundle.vendor.js
$ browser-unpack < bundle.vendor.js
[
{"id":"hello-world-js","source":"var helloString = 'Hello world!';\r\n\r\nvar hello = function hello() {\r\n return helloString;\r\n};\r\n\r\nmodule.exports = {\r\n hello: hello\r\n}","deps":{}}
]
Whereas, notice the full paths:
$ echo "require('hello-world-js');" > main.js
$ browserify --full-paths main.js > bundle.main.js
$ browser-unpack < bundle.main.js
[
{"id":"/Users/doug/Desktop/main.js","source":"require('hello-world-js');","deps":{"hello-world-js":"/Users/doug/Desktop/node_modules/hello-world-js/src/index.js"},"entry":true}
,
{"id":"/Users/doug/Desktop/node_modules/hello-world-js/src/index.js","source":"var helloString = 'Hello world!';\r\n\r\nvar hello = function hello() {\r\n return helloString;\r\n};\r\n\r\nmodule.exports = {\r\n hello: hello\r\n}","deps":{}}
]
Ideally disc would be refactored to remove the full path requirement.
I'm using the
external
functionality of browserify to generate my javascript files. It produce two files:app.js
andvendor.js
. Using disc with theapp.js
works perfectly. But it's do not work on thevendor.js
:sob:Here the blueprint of how I generate my two packages:
I guess is that
disc
cannot work on myvendor.js
file because there no entry point in this bundlevar b = browserify(null, {...});
.If I build all my dependencies in my
app.js
bundle, everything works.Tell me if you want my
vendor.js
file.