Skip to content
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

@ViewChild #18

Closed
KiaraGrouwstra opened this issue Feb 7, 2016 · 3 comments
Closed

@ViewChild #18

KiaraGrouwstra opened this issue Feb 7, 2016 · 3 comments

Comments

@KiaraGrouwstra
Copy link

I just managed to convert all my TS to JS using your plugin, except for one @ViewChild line, which works for TS but seems to fail conversion. Normally this annotation can take either a class or a string parameter, but either seem to fail somehow.

My minimum reproducable case is like this:

import { Component, ViewChild } from 'angular2/core';
@Component({
  selector: 'foo',
  template: `<p #x>foo</p>`,
})
export class Foo {
  @ViewChild('x') comp;
  constructor() {}
}

I wonder if something is up on my side, or if something might be up with conversion. Your implementation seems general enough I wouldn't expect it to fail for specific cases like this -- I'm just confused that only this part failed for me. Does it work for you?

Error statement, with plugin info but otherwise non-descriptive:

Module parse failed: ...\node_modules\babel-loader\index.js?{"cacheDirectory":true,"plugins":["syntax-async-functions","transform-regenerator","transform-runtime","add-module-exports","transform-decorators-legacy","angular2-annotations","transform-class-properties","transform-flow-strip-types"],"presets":["es2015","stage-1","stage-0"]}!...\foo.js Line 3: Unexpected token
You may need an appropriate loader to handle this file type.
| 'use strict';
|
| import _Object$defineProperty from 'babel-runtime/core-js/object/define-property';
|
| var _dec, _dec2, _class, _desc, _value, _class2, _descriptor;
@shuhei
Copy link
Owner

shuhei commented Feb 7, 2016

Hi @tycho01, may I see your minimum build config, such as webpack config and .babelrc, so that I can reproduce and investigate it?

@shuhei
Copy link
Owner

shuhei commented Feb 8, 2016

Also, I'd like to see versions of used npm modules.

@KiaraGrouwstra
Copy link
Author

Thank you; after investigating more I commented a line from babel-plugin-transform-runtime, fixing the syntax error. Unlike with TypeScript compilation it isn't working yet, but I think I'll need to further investigate. Until further indication this package might be related let's considered this closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants