question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does it work with browserify/CommonJS?

See original GitHub issue

I know it should work but for some reason it doesn’t for my setup. Steps to reproduce:

  1. install yeoman and yeogurt generator:
sudo npm install -g yeoman
sudo npm install -g generator-yeogurt
  1. start new project:
yo yeogurt
  1. install cesium:
npm install cesium
  1. add var Cesium = require('cesium'); to the src/_scripts/main.js
  2. 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
OnkelTemcommented, Oct 12, 2016

@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.

0reactions
OnkelTemcommented, Oct 12, 2016

@mramato

to use Cesium’s AMD modules with browserify, you can use the deamdify plugin

Thank you very much I’ll try.

The issue @hpinkos linked to was originally about browserify and webpack support and was closed once the webpack tutorial (https://cesiumjs.org/2016/01/26/Cesium-and-Webpack/) went live.

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found