Coder Social home page Coder Social logo

babel-plugin-es6-promise's People

Contributors

greenkeeper[bot] avatar greenkeeperio-bot avatar novemberborn avatar xescugc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

babel-plugin-es6-promise's Issues

Add es6-promise as peerDependency

For those who don't read the documentation as thorough as one should, would it make sense to add "es6-promise" as a peer dependency? So that you get a warning if it isn't installed?

Doesn't recognise static Promise functions

When I try to compile this file:

function hello() {
  return new Promise()
}

The output includes the polyfill.

However when compiling this file:

function hello() {
  return Promise.resolve("hello")
}

It doesn't add the polyfill.

es6 module transpile to amd error

Problem

events.js:160
      throw er; // Unhandled 'error' event
      ^
TypeError: xxx/src/lib/util.js: Property object of MemberExpression expected node to be of a type ["Expression"] but instead got null
    at Object.validate (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-types/lib/definitions/index.js:109:13)
    at Object.validate (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-types/lib/index.js:505:9)
    at NodePath._replaceWith (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-traverse/lib/path/replacement.js:176:7)
    at NodePath._remove (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-traverse/lib/path/removal.js:58:10)
    at NodePath.remove (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-traverse/lib/path/removal.js:30:8)
    at PluginPass.CallExpression (/Users/baidu/Documents/gitlab/mms-js-sdk/node_modules/babel-plugin-transform-es2015-modules-amd/lib/index.js:42:12)
    at NodePath._call (

Code

.babelrc

{
    "presets": [
        ["es2015", {"modules": "amd"}],
        "stage-1"
    ],
    "plugins": [
        "es6-promise"
    ]
}

Use like this:

export function invokeBySchema(url: string) {
    return new Promise((resolve, reject) => {});
}

issue

As your readme said, Promise is transpiled to

var _Promise = typeof Promise === 'undefined'
  ? require('es6-promise').Promise
  : Promise

While babel would throw error when transpiling memberexpression of require() above to AMD module. memberexpression like .Promise. For reference issue:babel/babel#4894.
So in this issue, I think correct transpiling way is:

var _Promise = Promise;
if (typeof Promise === 'undefined') {
  var _es6Promise = require('es6-promise');
  _Promise = _es6Promise.Promise;
}

Error: Cannot find module 'babel-plugin-es6-promise'

Hi,
I am getting this error when I try to deploy my app at heroku. Locally I am not having any issue.
Any Idea?

package.json

  "devDependencies": {
    "babel-eslint": "^7.2.3",
    "babel-plugin-es6-promise": "^1.1.1",
    "babel-plugin-transform-object-assign": "^6.22.0",
    "babel-preset-env": "^7.0.0-beta.3",
    "@babel/preset-react": "^7.0.0",
    "eslint": "^3.16.1",
    "eslint-plugin-react": "^6.10.0",
    "jasmine-core": "^2.5.2",
    "karma": "^1.7.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-firefox-launcher": "^1.0.1",
    "karma-fixture": "^0.2.6",
    "karma-html2js-preprocessor": "^1.1.0",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.2@next",
    "karma-super-dots-reporter": "^0.1.0",
    "karma-webpack": "^2.0.1",
    "phantomjs-prebuilt": "^2.1.13",
    "webpack-dev-server": "^3.1.4"
  },
  "dependencies": {
    "@rails/webpacker": "4.0.0-pre.3",
    "awesomplete": "^1.1.2",
    "classnames": "^2.2.5",
    "event_hub": "^1.1.2",
    "jquery": "^3.1.1",
    "lazy_loddar_js": "^1.2.0",
    "moment": "^2.22.2",
    "pikaday": "^1.6.1",
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "slick_box": "^2.2.0",
    "slide_rider": "^4.2.0",
    "startrack_js": "^2.0.1",
    "stick_stack": "^2.1.1",
    "wywiwyg_editor": "^0.1.0"
  }
}

arguments[i].apply is not a function

Since I introduced your plugin I'm getting the following error when building my application.

TypeError: arguments[i].apply is not a function
    at Compiler.apply (/Users/micky2be/Projects/node_modules/tapable/lib/Tapable.js:306:16)
    at webpack (/Users/micky2be/Projects/node_modules/webpack/lib/webpack.js:32:19)
    at processOptions (/Users/micky2be/Projects/node_modules/webpack/bin/webpack.js:305:14)
    at Object.<anonymous> (/Users/micky2be/Projects/node_modules/webpack/bin/webpack.js:363:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
    at startup (bootstrap_node.js:151:9)
    at bootstrap_node.js:542:3

webpack: 2.6.1
es6-promise: 4.1.0
babel-plugin-es6-promise: 1.1.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.