Skip to content

import in functions #2670

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

Closed
streamich opened this issue Apr 8, 2015 · 1 comment
Closed

import in functions #2670

streamich opened this issue Apr 8, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@streamich
Copy link

It looks like import is not allowed inside functions, like so:

function my_function() {
    import MyClass = require("./MyClass");
}

One can do var instead:

function my_function() {
    var MyClass = require("./MyClass");
}

It is useful for large apps to lazy-load modules as it runs, for faster start-up times. I was wondering why import is not allowed inside functions?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 8, 2015

looks like the same as #2508

@mhegazy mhegazy added the Duplicate An existing issue was already created label Apr 8, 2015
@mhegazy mhegazy closed this as completed Apr 20, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants