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

Incorrect emit when using external module import in JSX tag #3674

Closed
RyanCavanaugh opened this issue Jun 29, 2015 · 0 comments
Closed

Incorrect emit when using external module import in JSX tag #3674

RyanCavanaugh opened this issue Jun 29, 2015 · 0 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@RyanCavanaugh
Copy link
Member

From @prabirshrestha (thanks!) at #3564 (comment)


Tried building tsc locally and running this.

jake LKG
node ..\bin\tsc.js --jsx react -m umd -t es5 app.tsx button.tsx

app.tsx:

/// <references file="./react.d.ts"/>

import * as React from 'react';

import { Button } from './button';

export class App extends React.Component<any, any> {

    render() {
        return <Button />;
    }

}

button.tsx

import * as React from 'react';

export class Button extends React.Component<any, any> {

    render() {
        return <button>Some button</button>;
    }

}

The output app.js does not seem to set the button as a dependency.

/// <references file="./react.d.ts"/>
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
(function (deps, factory) {
    if (typeof module === 'object' && typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' && define.amd) {
        define(deps, factory);
    }
})(["require", "exports", 'react'], function (require, exports) {
    var React = require('react');
    var App = (function (_super) {
        __extends(App, _super);
        function App() {
            _super.apply(this, arguments);
        }
        App.prototype.render = function () {
            return React.createElement(button_1.Button, null);
        };
        return App;
    })(React.Component);
    exports.App = App;
});

This makes button_1 undefined. Even with -m amd it doesn't seem to work. Am I missing something here or is this a bug?

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 29, 2015
@RyanCavanaugh RyanCavanaugh self-assigned this Jun 29, 2015
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 1.6 milestone Jun 29, 2015
@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label Jun 30, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

1 participant