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

Rolling up errors out as "Promise is not defined" #254

Closed
ayushmad opened this issue Nov 1, 2015 · 3 comments
Closed

Rolling up errors out as "Promise is not defined" #254

ayushmad opened this issue Nov 1, 2015 · 3 comments

Comments

@ayushmad
Copy link

ayushmad commented Nov 1, 2015

This seems a really cool project and I was looking forward to use it. However I hit a small bug while using it.
When I use the following command to rollup.

$ rollup -i src/index.js -o newTest.js
Promise is not defined
ReferenceError: Promise is not defined
    at Object.write (/usr/local/lib/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/src/rollup.js:53:12)
    at /usr/local/lib/node_modules/rollup/bin/runRollup.js:110:18
    at tryCatch (/usr/local/lib/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/node_modules/es6-promise/lib/es6-promise/-internal.js:182:12)
    at invokeCallback (/usr/local/lib/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/node_modules/es6-promise/lib/es6-promise/-internal.js:194:13)
    at publish (/usr/local/lib/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/node_modules/es6-promise/lib/es6-promise/-internal.js:164:16)
    at flush (/usr/local/lib/node_modules/rollup/Volumes/Storage/www/ROLLUP/rollup/node_modules/es6-promise/lib/es6-promise/asap.js:86:25)
    at process._tickCallback (node.js:448:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)
    at node.js:935:3

However if I use a slightly different format of command it does rollup perfectly.

$ rollup --format umd  --name dq -- src/index.js > dq.js

This might be a really small bug with the command line parameter. I just wanted you to be aware of this.
Again thank you for creating this tool.

@Rich-Harris
Copy link
Contributor

Ah, looks like we forgot to import Promise in src/rollup.js, so it's falling back to global.Promise. We'll fix that for the next version.

In the meantime, are you using an old version of Node.js (node -v to find out)? If you're running 0.12 or lower then Promise isn't available, but if you install an up-to-date version from https://nodejs.org/en/ then it should work.

@ayushmad
Copy link
Author

ayushmad commented Nov 1, 2015

You are right. My node version is 0.10.40

$ node -v
v0.10.40

I updated my node version to 5.0.0 and everything works great now.
Thanks for the help.

@TrySound
Copy link
Member

TrySound commented Nov 1, 2015

@Rich-Harris node 0.12 supports Promises

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

No branches or pull requests

3 participants