简体   繁体   中英

Breeze.js and WebPack

Has anyone out there used breeze.js with webpack?

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)?

I just get the error breeze is not defined or an error about Q not being setup.

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.

Q

To get Q working, you should probably use the ProvidePlugin. Breeze expects Q to be uppercase, but in npm land it's lowercase. Assuming you've run npm install --save q , then you should be able to add:

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

to your webpack.config.js and that will keep breeze happy.

breeze

This might also resolve this issue with breeze is not defined : that could be because Q is not loaded. 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');

Alternatively, you can include require("expose?breeze!breeze-client/breeze.debug"); just once in your entry file and that will add breeze to global scope.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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