Webpack不承认Bluebird Promise

时间:2017-11-06 17:22:29

标签: typescript promise bluebird webpack-2 typescript-typings

Visual Studio intellisense正确识别Promise来自Bluebird,但似乎webpack变得混乱,当我在浏览器中调试主包时,我发现Promise不是' bluebird'的承诺。

我正在使用aspJ的Asp.net核心模板。我有: " webpack":" 2.5.1", " bluebird":" 3.5.1", " @ types / bluebird":" 2.0.33"

这是我的ts.config:

{ 
  "compilerOptions": {
    "baseUrl": "./ClientApp",
    "module": "commonjs",
    "moduleResolution": "node",
    "target": "es5",
    "jsx": "react",
    "sourceMap": true,
    "noImplicitAny": true,
    "skipDefaultLibCheck": true,
    //"strict": true,
    "lib": [ "dom", "es5", "es2015.iterable", "scripthost", "es2015.promise" ],
    "types": [ "webpack-env" ],
    "experimentalDecorators": true
 },
  "exclude": [
      "bin",
      "node_modules"
  ]
}

如何配置webpack以始终使用' bluebird'保证?

1 个答案:

答案 0 :(得分:0)

位于webpack配置的顶部

global.Promise = require('bluebird')