puerts-ts-loader
puerts-ts-loader copied to clipboard
load Typescript in Unity without tsc
查看了Sample2的 webpack的例子 ``` env = new JsEnv(new TSLoader(System.IO.Path.Combine(Application.dataPath, "../Puer-Project/out"))); env.ExecuteModule("main.mts"); ``` 引入了 Axios 运行okay, 这样的形式 我理解了,但是我有一个其他形式的用法比如 xlua,那种一个MonoBehaviour对应一个Ts脚本的情况 伪代码 ``` class test : xx { protected override void InternalAwake() { base.InternalAwake();...
运行sample1 看到所有ts文件都是以 .mts 结尾的,我尝试修改为.ts 在不加 PUERTS_TSLOADER_DISABLE_EDITOR_FEATURE 宏定义的时候没问题 Editor运行okay; 但是 加了宏定义 就会报错,但是 如果依然使用 .mts 然后 Release TS To Resource 这时候 出来的是 .mjs 文件 这时候运行没问题 想问下 为什么
Replace `path` and `fs` by Unity's api here; https://github.com/zombieyang/puerts-ts-loader/blob/main/libs/ts-compile/tsc.ts https://github.com/zombieyang/puerts-ts-loader/blob/main/libs/ts-compile/release.ts
Exception: __puer_execute__.mjs:194: Error: c# exception:puerts\ts-loader\node-resolve.mjs:78: Error: ERR_INVALID_URL_SCHEME file Error: ERR_INVALID_URL_SCHEME file at fileURLToPath (puerts\ts-loader\node-resolve.mjs:78:15) at packageLoad (puerts\ts-loader\node-resolve.mjs:5361:16) at global.__puer_resolve_module_content__ (__puer_execute__.mjs:194:32),stack: at Puerts.GenericDelegate.Func[T1,TResult] (T1 p1) [0x0005a] in .\Library\PackageCache\[email protected]\Runtime\Src\Default\JSType\GenericDelegate.cs:548 at NodeModuleLoader.ReadFile (System.String...
https://github.com/zombieyang/puerts-ts-loader/blob/67f37aa94867486303a6cdcfb9d910052a503217/upm/Runtime/NodeModuleLoader/NodeModuleLoader.cs#L13 ### 建议修改为: ```csharp _nodeModulePath = Uri.EscapeUriString(PathHelper.normalize(Path.Combine(nodeModulePath, "node_modules").Replace("\\", "/"))); ``` 建议对路径进行 URI 编码,与 JS 中使用 URL 进行编码的行为一致。
*** 本地环境: - 已通过openupm的方式安装`com.tencent.puerts.core 2.0.5`和`com.tencent.puerts.ts-loader 2.0.5` - Vscode:Version: 1.90.1 (Universal), Unity: 2022.3.30f1 问题: - 按照readme提供的示例代码, 如图报错: 'Puerts.TSLoader' is a namespace but is used like a type ```TS var env =...
最近我们将项目使用的 puerts 和 loader 版本都进行了更新. 更新后发现加载 ts 脚本的速度比之前慢了非常多. 使用的 Unity 版本: 6000.0.26f1 使用 Puerts 版本: v2.0.5 - Node.js 版本 以下三种测试方法都是使用同样的代码库, 唯一的区别是 Jsenv 是否使用 tsloader 进行读取/使用的版本不同. 消耗时间则是通过 unity profiler 进行统计. 不使用...
引擎:团结 1.3.4 ts-loader: 2.0.5 puerts: 2.1.0 使用Sample1 工程,出现: > Exception: undefined:0: Error: c# exception:undefined:0: ReferenceError: require is not defined ReferenceError: require is not defined at Object.239 (puerts\ts-loader\main.gen.mjs:184824:1) at __webpack_require__ (puerts\ts-loader\main.gen.mjs:184876:41)...
I apologize if my English isn't good; I'm not very good at communicating in Chinese either. I'm trying to use hyperswarm in PuerTS [hyperswarm/dht](https://www.npmjs.com/package/@hyperswarm/dht) This comes with multiple dependencies on...