Skip to content

Syntax errors are ignored in loaded modules #438

Open
@windbridges

Description

@windbridges

When required script contains syntax errors, it silently skips it just like file was not included.

            $v8 = new V8Js();
            $v8->setModuleLoader(function ($path) {
                return 'synta}{ error!'; // returns undefined
                // return 'module.exports = 1'; // this works
            });
            $script = 'let a = require("file.js"); print(a)';
            $r = $v8->executeString($script);
            echo $r;

Is there any way to get syntax error exception when module loader returns invalid code?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions