Closed OliverJAsh closed 9 years ago
For context: my sandboxed module (foo.js
) is written in ES6, so I have written a transformer to compile to ES5. However, a module (bar.js
) that the sandboxed module imports is also written in ES6. I realise this can be fixed by setting singleOnly: true
, and running the file that runs SandboxedModule.require
(main.js
) inside an ES6 environment. However, I do want the nested require to be sandboxed (singleOnly: false
) so that I can mock its dependencies – but I also want its source transformed.
Just re-assuring myself that my requirements here are not out of the ordinary.
+1
Given a dependency tree of:
main > foo > bar
.main
requiresfoo
as a sandboxed module, applying the source transformer.foo
requiresbar
, however the source transformer is not applied.This is demonstrated in my example where I log each time the source transformer is called (see gist for full example):
Output:
I expect:
https://gist.github.com/OliverJAsh/3351f4a96a02ef2e294e