首页 > 其他分享 >Compile Unity jslib in command

Compile Unity jslib in command

时间:2023-06-15 16:37:20浏览次数:45  
标签:... bundler Compile Unity command import My jslib


Compile Unity jslib in command

(Jin Qing’s Column, May., 2023)

My Unity project has a jslib file, which has many syntax errors.
But Unity does not report these jslib errors like cs files, until the WebGL build fails with a error like this:

Failed process stderr log:
error: failure to execute js library "E:\Test\Unity\My project (1)\Assets\Plugins\without_a_bundler.jslib": SyntaxError: Unexpected token import,,SyntaxError: Unexpected token import
    ...
    at run (bootstrap_node.js:394:7)
preprocessed source (you can run a js engine on this to get a clearer error message sometimes):
=============
let wasm;

...

lib = {
    ...
};

mergeInto(LibraryManager.library, lib);


=============

Internal compiler error in src/compiler.js! Please raise a bug report at https://github.com/kripken/emscripten/issues/ with a log of the build and the input files used to run. Exception message: "SyntaxError: Unexpected token import" | SyntaxError: Unexpected token import
...
Traceback (most recent call last):
  ...
  File "C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\tools\jsrun.py", line 132, in run_js
    raise Exception('Expected the command ' + str(command) + ' to finish with return code ' + str(assert_returncode) + ', but it returned with code ' + str(proc.returncode) + ' instead! Output: ' + str(ret)[:error_limit])
Exception: Expected the command ['C:/Program Files/Unity/Hub/.../Editor/Data\\Tools\\nodejs\\node.exe', '--stack_size=8192', '--max-old-space-size=4096', ..., 'E:\\Test\\Unity\\My project (1)\\Assets\\Plugins\\without_a_bundler.jslib', ...] to finish with return code 0, but it returned with code 1 instead! Output: // The Module object: Our interface to the outside world. We import
...

It is hard to locate the error from the message, and the WebGL building takes a long time as well.

Try to run the command, which is hinted in the message:

"C:/Program Files/Unity/Hub/.../Editor/Data\\Tools\\nodejs\\node.exe" ^
  --stack_size=8192 --max-old-space-size=4096 ^
  "E:\\Test\\Unity\\My project (1)\\Assets\\Plugins\\without_a_bundler.jslib"

Ouput:

E:\Test\Unity\My project (1)\Assets\Plugins\without_a_bundler.jslib:205
        input = new URL('without_a_bundler_bg.wasm', import.meta.url);
                                                     ^^^^^^
SyntaxError: Unexpected token import
...

It is a quick way to using nodejs to check the jslib file.
When all errors are fixed, the result output should be like:

E:\Test\Unity\My project (1)\Assets\Plugins\without_a_bundler.jslib:226
mergeInto(LibraryManager.library, lib);
^

ReferenceError: mergeInto is not defined
...


标签:...,bundler,Compile,Unity,command,import,My,jslib
From: https://blog.51cto.com/u_16162321/6493148

相关文章

  • Unity3D:场景视图视图选项
    推荐:将NSDT场景编辑器加入你的3D工具链3D工具集:NSDT简石数字孪生“场景视图视图选项”工具栏您可以使用“场景视图视图选项”工具栏“叠加”来选择用于查看场景以及启用/禁用照明和音频的各种选项。这些控件仅在开发期间影响场景视图,对构建的游戏没有影响。绘制模式(Drawmo......
  • Unity大场景优化
    在Unity中,你可以使用视距剔除(LOD)和对象池等技术来解决场景中远离摄像机的物体隐藏和性能优化的问题。视距剔除(LOD):视距剔除是一种根据摄像机与物体之间的距离,动态地调整物体的细节级别或替代模型的技术。这意味着当物体远离摄像机时,可以使用较低的细节模型替代它们,从而减少渲染......
  • 【unity】TextMeshPro文本抖动效果
    文本抖动效果前言在部分电子游戏中,当角色处于狂喜、紧张或恐惧等激动情绪时,角色对话框中的文字会触发抖动等效果,这为游戏增色不少,如下。当我在网上查找相关资料时,没找到相关的实现,也可能是我搜索的关键词不对。总之今天来实现一下这个效果。实现思路目标效果是:在同一帧的动......
  • yarn 安装进行时,显现错误 node_modules\gifsicle: Command failed.
    1.错误显示[4/5]Buildingfreshpackages...[7/13]⠠jpegtran-bin[6/13]⠠gifsicle[8/13]⠠mozjpeg[4/13]⠠gifsicleerrorE:\IdeaStudyProjects\ucthings-ui-vue\node_modules\gifsicle:Commandfailed.Exitcode:1Command:nodelib/install.jsArguments:D......
  • mingw compile libuv
      Compilefailedinmingw64https://github.com/libuv/libuv/commit/be8e237a8e462f8517392eccf0f94a30d16d7ef3 win:defineERROR_ELEVATION_REQUIREDforMinGW#1195https://github.com/libuv/libuv/pull/1195 c:\Users\Administrator\Downloads\libuv-v1......
  • Unity3D学习笔记(二)创建地形和漫游
    七月3201212:35上午上一章粗略介绍了一下Unity游戏引擎的概念定义和界面功能,这次就来实践一下。我们的目标是没有蛀牙(误),目标是创建一个地形,上面有山脉和盆地,然后再放置一个人物,以第一人称的视角来漫游、观察我们所创建的世界。 在开始设计游戏之前我们需要先重新......
  • Unity3D学习笔记(一)界面介绍
    六月2020128:05下午从开始学习Unity到现在已经过去近三个月了,期间零零散散地在网上找教程、实例,感觉印象不够深刻。好多知识点不是被忽略了,就是被遗忘了。有幸在六一儿童节的时候发现了3DBuzz的基础视频教程,犹如介绍所言,几乎详细到每个菜单和按钮。为了部落(误),为......
  • WPF 绑定command在触屏上操作时,即使点中button也可能不触发
    现象:WPF程序绑定的command在触摸屏上,点击button后,button绑定的事件偶尔会出现不响应的情况。确认100%点击有效,不会出现误触的情况。但是用鼠标点击,绝对不会出现这种现象。 原因:在非触屏环境,bingdingcommand是由点击来触发,即是使用鼠标等输入设备来执行点击触发command,调用......
  • maven-compiler-plugin build-helper-maven-plugin Maven-assembly-plugin
    三个插件都是是用干啥的maven-compiler-plugin进行源代码的编译build-helper-maven-plugin项目中添加额外的资源、源代码、构建输出目录和依赖项等Maven-assembly-plugin生成可执行jar包<build><plugins><plugin><groupId......
  • # command-line-arguments day1/goroute/main.go:10:6: undefined: test_goroute
    在goland中执行gobuildmain.go命令时报错#command-line-argumentsday1/goroute/main.go:10:6:undefined:test_goroute上面的原因是调用的方法没有引用,但用的包名是一样的,照理说应该引用了别人给的文案是把调用的函数的文件也一起放在gorun命令后面执行gorunmain.go......