Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require() does not work the same way as Node? #3

Open
jasonzhuang opened this issue Oct 14, 2013 · 0 comments
Open

require() does not work the same way as Node? #3

jasonzhuang opened this issue Oct 14, 2013 · 0 comments

Comments

@jasonzhuang
Copy link

Assuming I define a js file named service.js, and it is pretty simple.
/**
service.js

define('service', [], function(){
    var service = {};
    service.log = function(msg){
        console.log("super log: " + msg + new Date().time)
    }
    window.service = service;
})

**/

require('service');
console.log(typeof window.service);//undefined

As for Node, when require some module, it can use immediately. So do I make some misunderstand?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant