4

Has anyone found a way to import a module from another file without using AMD or CommonJS (using the import keyword)? I don't think this is possible, but I want to double check in case there is some clever way to do it.

Assuming we don't want AMD nor CommmonJS I am just using the ///references syntax to pull the types into the file. That gives me the types and I don't have to use import at all. Just means I have to order the script tags properly myself in the HTML. But I'm OK with that for now.

/// <reference path="router.ts" />

1 Answer 1

5

Yes - you use the reference comment when you are not using CommonJS or AMD.

How you then bundle your JavaScript files is totally up to you - if you are using ASP.NET the new script bundles are a great solution.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for confirming that. Yes, I plan to use ASP.NET bundling and handle dependency ordering myself on small projects. For larger ones I use require.js and AMD.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.