Vaccano Vaccano - 1 year ago 190
Javascript Question

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.

Answer Source


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.


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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download