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

Variable global will not works in node #834

Closed
ai opened this issue Jul 23, 2014 · 5 comments
Closed

Variable global will not works in node #834

ai opened this issue Jul 23, 2014 · 5 comments

Comments

@ai
Copy link

ai commented Jul 23, 2014

I use browserify to build standalone build of Autoprefixer. Any some project uses standalone build in node.

New Autoprefixer will include traceur and I find problem with it, browserufy and node.

When somebody uses global browserify will pack code into:

(function (global) {
    
})(typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});

But node has no self and window, so traceur fall with Object.defineProperty called on non-object because it call defineProperty on global.Object.

Why not:

(function (global) {
    
})(typeof global !== 'undefined' ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});
@ai
Copy link
Author

ai commented Jul 23, 2014

@substack related issue in PostCSS: postcss/postcss#58

@ai
Copy link
Author

ai commented Jul 23, 2014

@substack I can send PR, but I didn’t found module, who wrap global.

@ai ai changed the title Variable gloabl will not works in node Variable global will not works in node Jul 23, 2014
@andreypopp
Copy link
Contributor

Did you try to build it with --bare:

 --bare 

    Alias for both --no-builtins, --no-commondir, and sets --insert-global-vars
    to just "__filename,__dirname". This is handy if you want to run bundles in
    node.

@ai
Copy link
Author

ai commented Jul 23, 2014

@andreypopp didn’t help. Same issue. Option --insert-global-vars just wrap all code, but uses detector.

@ghost
Copy link

ghost commented Jul 24, 2014

Fixed in 5.0.3.

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

No branches or pull requests

2 participants