Does it work with browserify/CommonJS?
See original GitHub issueI know it should work but for some reason it doesn’t for my setup. Steps to reproduce:
- install yeoman and yeogurt generator:
sudo npm install -g yeoman
sudo npm install -g generator-yeogurt
- start new project:
yo yeogurt
- install cesium:
npm install cesium
- add
var Cesium = require('cesium');to thesrc/_scripts/main.js - run
gulp build:
[04:12:47] Browserify compile error:
Error: Cannot find module 'lang' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:46:17
at process (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:173:43)
at ondir (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:188:17)
at load (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:69:43)
at onex (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:92:31)
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
[04:12:47] gulp-notify: [Error running Gulp] Cannot find module 'lang' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
./src/_scripts/main.js was browserified: 1.968s
[04:12:47] Browserify compile error:
Error: Cannot find module 'prim' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:46:17
at process (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:173:43)
at ondir (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:188:17)
at load (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:69:43)
at onex (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:92:31)
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
[04:12:47] gulp-notify: [Error running Gulp] Cannot find module 'prim' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
[04:12:47] Browserify compile error:
Error: Cannot find module 'logger' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:46:17
at process (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:173:43)
at ondir (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:188:17)
at load (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:69:43)
at onex (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:92:31)
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
[04:12:47] gulp-notify: [Error running Gulp] Cannot find module 'logger' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
[04:12:47] Browserify compile error:
Error: Cannot find module 'parse' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:46:17
at process (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:173:43)
at ondir (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:188:17)
at load (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:69:43)
at onex (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:92:31)
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
[04:12:47] gulp-notify: [Error running Gulp] Cannot find module 'parse' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
[04:12:47] Browserify compile error:
Error: Cannot find module 'optimize' from '/var/www/sites/cesium/cs2/node_modules/requirejs/bin'
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:46:17
at process (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:173:43)
at ondir (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:188:17)
at load (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:69:43)
at onex (/var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:92:31)
at /var/www/sites/cesium/cs2/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
...
Ideas?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Use CommonJS npm packages in the browser with Browserify
A convenient way to use CommonJS npm packages in client-side JavaScript using Browserify. Sometimes you might need to use the functionality ...
Read more >Getting Started with CommonJS Modules and Browserify
Browserify is a command line tool that allows us to use CommonJS modules in the browser. Let me know what your thoughts are...
Read more >Why you should ditch Browserify and CommonJS in the http/2 ...
The solution for browserify is to bundle everything together and hence it can just grab that reference for you in a map. However,...
Read more >how to build modular applications with browserify
browserify is a tool for compiling node-flavored commonjs modules for the browser. You can use browserify to organize your code and use third-party...
Read more >How to work with Browserify?
Browserify is one of the most popular implementations of CommonJS API which allows to define modules in JavaScript code sent to the browser....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@hpinkos Using Google Groups is indeed a sort of sophisticated torture, a way to exhibit “love” to users. But ok, if you are so special, I’ll post there.
@mramato
Thank you very much I’ll try.
So that’s the reason - the issue referenced has been closed not resolving the browserify part and so I’ve created this issue. (Also, there is no any mentions of deamdify in that discussion).
As for the webpack guide - yeah, I’ve reviewed it and while I’m not very familiar with webpack, the guide looks pretty complicated. Seems like Cesium distribution needs some standardization/unification (judging by comparison with other libraries and how they integrate into projects).
That said, CommonJS seems to me like a more appropriate/convenient tooling for a distribution 😃