我对以下 SystemJS 的 TypeScript 插件有疑问:
https://github.com/frankwallis/plugin-typescript/
这是它的描述
A plugin for SystemJS which enables you to System.import TypeScript files directly. The files are compiled in the browser and compilation errors written to the console.
我想知道这种插件的用例是什么。
- 为什么开发者会直接导入ts文件在浏览器中编译,而不是在开发过程中编译导入js文件?
- 在浏览器中执行此操作是否会降低性能和加载时间?
- 它应该只用于开发环境吗?
最佳答案
plugin-typescript 作者在这里。浏览器内编译严格来说是一种开发工具,在生产环境中,您可以使用 systemjs-builder(结合 plugin-typescript)来创建一个包含所有已转换 javascript 的文件。
自从该插件最初开发以来,使用 typescript 和 systemjs(typescript 单文件转译、vscode、systemjs 热重载、typescript system.register 输出,仅举几例)时,许多新的工作流程变得可用... ) - 哪一个适合您将取决于您的应用程序的大小、您使用的平台/服务器以及您自己的个人喜好。
关于javascript - SystemJS - TypeScript 加载器用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36283635/