Skip to content

Commit

Permalink
Add support for .cjs file extensions (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieldelcore authored Jun 22, 2023
1 parent 79d057f commit 24056cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PluginVm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class PluginVm {
moduleInstance = sandbox.module;

const filePathExtension = path.extname(filePath).toLowerCase();
if (filePathExtension === ".js") {
if (filePathExtension === ".js" || filePathExtension === ".cjs") {
const code = fs.readFileSync(filePath, "utf8");
// note: I first put the object (before executing the script) in cache to support circular require
this.setCache(pluginContext, filePath, moduleInstance);
Expand Down

0 comments on commit 24056cf

Please sign in to comment.