简体   繁体   English

Breeze.js和WebPack

[英]Breeze.js and WebPack

Has anyone out there used breeze.js with webpack? 有没有人在网上使用breeze.js?

I cannot seem to get it to work together. 我似乎无法让它一起工作。 If anyone has made this work, can you please share your webpack.config.js (and any other relevant configurations)? 如果有人做了这个工作,你可以分享你的webpack.config.js(以及任何其他相关配置)吗?

I just get the error breeze is not defined or an error about Q not being setup. 我只是得到错误breeze is not defined或关于Q没有设置错误。

If you use typescript I would love to see how you set that up too, but I would be happy with just a javascript solution. 如果你使用打字稿,我很乐意看到你如何设置它,但我会很高兴只有一个JavaScript解决方案。

Q Q

To get Q working, you should probably use the ProvidePlugin. 要使Q工作,您应该使用ProvidePlugin。 Breeze expects Q to be uppercase, but in npm land it's lowercase. Breeze希望Q为大写,但在npm的土地上它是小写的。 Assuming you've run npm install --save q , then you should be able to add: 假设你运行了npm install --save q ,那么你应该能够添加:

new webpack.ProvidePlugin({
    Q: "q"
})

to your webpack.config.js and that will keep breeze happy. 到你的webpack.config.js,这将保持清风愉快。

breeze 微风

This might also resolve this issue with breeze is not defined : that could be because Q is not loaded. 这也可能解决了这个问题,因为breeze is not defined :这可能是因为没有加载Q. Otherwise, make sure you've installed breeze via npm or bower, and then wherever you need breeze, you need to var breeze = require('breeze-client/breeze.debug'); 否则,确保你已经通过npm或bower安装了微风,然后你需要微风,你需要var breeze = require('breeze-client/breeze.debug');

Alternatively, you can include require("expose?breeze!breeze-client/breeze.debug"); 或者,你可以包括require("expose?breeze!breeze-client/breeze.debug"); just once in your entry file and that will add breeze to global scope. 只需在您的输入文件中输入一次,这将为全局范围增添微风。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM