Skip to content

Conversation

@rmja
Copy link

@rmja rmja commented Jan 20, 2025

Consider the Engine configuration with enabled modules:

options.EnableModules("/modules-directory");

where the contents of /modules-directory is:

/modules-directory/my-module/index.js
/modules-directory/my-module/helper-file.js

The content of the index file references the helper file is:

export * from "./helper-file.js";

Note that the path to ./some-file.js is relative to the index file.

If we then do

engine.Modules.Add("my-module", File.ReadAllText("/modules-directory/my-module/index.js"));

Then when calling into my-module, the some-file.js file should be found from the /modules-directory/my-module directory, and not from /modules-directory.

@rmja
Copy link
Author

rmja commented Jan 20, 2025

Okay, I can see from the failing test that this is actually the intended behavior?

@lahma
Copy link
Collaborator

lahma commented Jan 20, 2025

Generally the test cases establish the current API contract so I guess this would be a breaking change, unless the old behavior can be considered incorrect.

One option is to provide more extension points if needed so that you can achieve your goal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants