#2684·brython

JavaScript.import_js() 发生崩溃,但 JavaScript.import_modules() 运行正常

作者: cjlee112创建于 2026年5月14日更新于 2026年5月14日

运行 `JavaScript.import_js('https://threejs.org/build/three.module.js', alias='THREE')` 会导致崩溃,错误消息为 "Uncaught SyntaxError: Cannot use import statement outside a module"。请注意,这是在 Gallery 示例中使用的模块(https://brython.info/gallery/three_webgl_interactive_cubes.html)。但是,使用 import_modules() 运行完全相同的代码则没有问题:

内容来源: brython-dev/brython