-
Notifications
You must be signed in to change notification settings - Fork 77
v3.0.0-rc.1 angular.module is not a function when using webpack #338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think I know what the problem is. It's a difficulty in the interop between ES6 imports, ES6 modules, CommonJS imports, and CommonJS modules. I think I have it fixed in 3.0.0-rc.1. |
If you're using webpack or browserify (or something similar), change it to |
@jmdobry Sorry, entirely my bad this is actually a report for 3.0.0-rc.1. |
@MikaAK Here is a Webpack ES6 build example that works: https://github.com/js-data/js-data-angular/blob/3.0/build_examples/webpack_es6/app.js And here is another one: https://github.com/js-data/js-data-angular/blob/3.0/build_examples/webpack_es6_2/app.js What are you doing differently? |
@MikaAK I figured out the problem. You're using the bower-webpack plugin, which is designed to wrap bower libraries that are not already requireable via CommonJS, so it wraps each library in something like I had to diff the You have two fixes: Recommended:
Alternative: Find a way to exclude just the js-data and js-data-angular libs from the bower-webpack-plugin's search path, and let webpack find them naturally. Closing because I’m not sure this is an issue, if you are convinced that this is really a bug, please feel free to re-open the issue and add more information:
Otherwise support is done via the Gitter Channel or the mailing list. |
I encountered the same problem a while ago (i was getting a 'angular.* is not a function' [very cryptic error message btw]) and the problem was related to the bower components, just like @jmdobry suggested. My solution, just in case anyone else had this same problem, was to get rid of every bower module that was already accessible via npm. That solved the issue. |
I'm having troubles importing js-data-angular into my webpack project. Currently, my entry point is importing angular and js-data-angular. However when it gets to js-data-angular it throws
angular.module is not a function
.All my other imports seem to work it's just js-data-angular! I found out when this line gets called the require result for angular is an empty object. Is there something I'm missing? I do have angular in my project and can use it fine without js-data-angular.
My
app.js
looks as follows:The text was updated successfully, but these errors were encountered: