使用模块导出的 属性 填充 webpack.ProvidePlugin

Shim with webpack.ProvidePlugin using a module's exported property

如何将 Promisewebpack.ProvidePlugin 填充到 require('q').Promise

webpack.config.js 中填充 $

plugins: [ new webpack.ProvidePlugin({ '$': 'jquery' }) ]

shimmig Promise 使用 q.Promise 的等价物是什么?

// attempt:
plugins: [ new webpack.ProvidePlugin({ Promise: 'q.Promise' }) ]

尝试

plugins: [
  new webpack.ProvidePlugin({
    Promise: ['q', 'Promise']
  })
]

Webpack ProvidePlugin doc