-
Notifications
You must be signed in to change notification settings - Fork 3k
1.0.0alpha0 doesn't return module name #2506
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
Weird, it should be exporting it. https://github.com/angular-ui/ui-router/blob/1.0.0alpha0/src/ui-router.ts#L11 What is coming out of require('angular-ui-router') for you? |
It seems to return an object. Here's a screenshot from the Chrome console: Here's the error message I get:
|
We transpile from ES6 modules, so that's why it looks like that. I'm not sure if we can do that and support legacy AMD identically to before. If you're using ES6, then you can change your code to look like this: import angular from 'angular';
import uiRouter from 'angular-ui-router';
angular.module('myApp', [
uiRouter
]); Alternatively, you can just do |
I think we can remain as a UMD module and fix the bundle using with a webpack option. See the visualizer config: |
I was wrong. Looks like there's no simple way to support CJS default
If you are building your app using CommonJS require, use @nateabele's workaround to get the module name or use ES6 module import Going forward, we are going to embrace ES6 modules. Some more reading: http://stackoverflow.com/questions/33505992/babel-6-changes-how-it-exports-default |
When using Webpack (or probably some other similar library), it was possible to import ui-router 0.2.* like this:
This is possible because when ui-router is imported, the script returns the module name
'ui.router'
. The 1.0.0alpha0 doesn't do this, which means I need to separately import it:The text was updated successfully, but these errors were encountered: