-
-
Notifications
You must be signed in to change notification settings - Fork 571
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
RC6: import @angular/core/src/facade/lang
causes traceur error
#219
Comments
@angular/core/src/facade/lang
@angular/core/src/facade/lang
causes traceur error
yes, I'm on it right now, struggling with the changes to the test API which breaks my tests (the code of the lib is already updated), expect a release soon |
Thanks for jumping on this so quickly! |
I must admit, in my projects I had to ditch tests because of the testing API changes in ng2... It will be a while before I "trust" the testings.. given the discussions on Github.. Thank you for your effort, Olivier, it is much appreciated! |
yeah they really fucked things up :( |
In case you missed it, I've updated the lib to rc6 |
Thanks @ocombe! Works like a charm! |
You are the best!! |
On plunkr we map directly npm to |
I found the issue and it is happening only with this library. |
did you import from |
Odd, have to dig deeper into this later today. |
it doesn't work because there is no ng2-translate file in the bundles directory which is where is searches now, I think |
Let me try to explain here. First of all, I'm not an expert in SystemJS/Webpack at all. I'm pretty noob on those to be honest. BUT, when I take your plunkr, it just works. I can change the language and it changes the interface. As you said before, the config maps Open up import {TranslateService} from 'ng2-translate/index'; And it will still work. This is what they call a Barrel. It's the main entry point for everything inside import {TranslateService} from 'ng2-translate'; But SystemJS does not support that (currently). I agree that importing @ocombe Why does the bundles directory has the type definitions? The UMD bundle has nothing to do with typings. It will not try to load them or whatsoever. If someone imports If you look at how Angular2 ships it I think we should try to mimick that behavior is much as possible as people are already familiair with that. |
There are typings in the bundles folder because I forgot to disable typings generation when generating the bundle :D When you import from |
Hahah, those things happen :D. Will check this today. Eager to know the answer :p. |
@ocombe sorry for the delay.
error message: Error loading http://172.16.128.230/node_modules/ng2-translate/ng2-translate.js as "ng2-translate/ng2-translate" If I map as below, the following error is thrown error message: GET node_modules/ng2-translate/ng2-translate/ng2-translate.js 404 (Not Found) Now if I go to my browser and look for ng2-translate.js to path where is mapped I also I get "Cannot GET /node_modules/ng2-translate/bundles/ng2-translate.js" from my browser. If I do the same thing with other libraries I can access the JS file. Any ideas of how I could solve this? :( I will look at @SamVerschueren approach and see if it works. |
In my systemjs I ended mapping as below: then in my components where I import the TranslateService and the TranslateModule I imported as below: As in my first comment, this problem started when I upgraded to 3.1.3. When I was using 3.1.2
and my systemjs looked like this I know this is a temporal workaround, @ocombe I would appreciate if you let us know if you decide switching back to commonjs. |
I believe this has nothing to do with CommonJS/UMD. It has everything to do with the configuration of In the new release (I thought we supported the old notation as well but not sure if everything went well there), you have to import from Because SystemJS does the module resolution, you don't have to import from Angular 2 suggests you use their UMD bundles in development. You could either choose to do that or not, that's up to you. The only thing you have to change is how SystemJS consumes the library in the configuration. In the plunker you provided, you can either choose to consume the CommonJS files, or the UMD bundle. CommonJS
UMD
This doesn't change anything on how you import them in your main files. It just tells SystemJS where to look if it sees an import statement for
You can just rename it to whatever you want. I adjusted the plunk for both scenarios, CommonJS and UMD. CommonJS: http://plnkr.co/edit/Qs9n2NSqGynEKmQvL5Xy I really hope this helps and gives a better understanding of how things work. |
We should probably add all of this to the readme |
@ocombe Yes, was thinking the same. It just follows how Angular does it though, but apparently the Angular docs seems clearer :). Maybe we should create a |
We can use the wiki here, and link to it from the readme. I gave you collaborators rights on the repo. |
Thanks 🎉
👍 |
Unsure if it's related but I'm getting
When I run karma test. Those files don't even exist in my node_module directory (under that path) . my app.component.ts imports from ng2-translate. Any idea? |
well yeah it doesn't exist, you're trying to load |
Nothing to do with this as lodash suffers the same fait. Not that familiair with Karma but either it's a karma config thing, or a SystemJS config thing when it can't find the correct file in the correct location. If it's working in development, it's probably Karma who can't find the correct file, so that means it's a karma config. When I open a Karma config file, this is what I see ...
files: [
// paths loaded via module imports
// Angular itself
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: true },
{ pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: false },
// NgRx
{ pattern: 'node_modules/@ngrx/**/*.js', included: false, watched: true },
{ pattern: 'node_modules/@ngrx/**/*.js.map', included: false, watched: false },
// many more
]
... Try to add |
Adding it to my karma config file doesn't work. This is based off of angular2 seed for what it's worth. If my app.component.ts is importing from ng2-translate (and that's the standard) why would it be looking for non existent files? |
Like I said, I'm not familiair with Karma so I can't answer that question. The thing I know though is that it's the module bundler (SystemJS or Webpack) that does the module resolution. That's why you need to configure SystemJS that it looks for I don't think this discussion belongs here though and is more like a StackOverflow support question. Like I said, it doesn't find lodash as well so it's definitely a config problem. |
@SamVerschueren, thank you for explaining. I mapped as you mentioned here fixed my issue. |
@3du4 Glad you got it working :) |
I'm submitting a ... (check one with "x")
Current behavior
Running an Angular2 application with
ng2-translate
fails because it looks fortraceur.js
but fails to find it. In RC6, you should import the bundles as described by @robwormald in his gist.As I believe, you where already in contact with @robwormald for this?
Expected/desired behavior
To just work out of the box :).
Reproduction of the problem
Upgrade to RC6, load in the bundles instead and it will fail with the
traceur
error.What is the motivation / use case for changing the behavior?
Because
ng2-translate
seems to be unusable in RC6/Please tell us about your environment:
The text was updated successfully, but these errors were encountered: