-
Notifications
You must be signed in to change notification settings - Fork 13
Error when resolving environmentModulePath #11
Comments
Thanks for the report. Currently, the path to the module that resoves to the Twing environment needs to be absolute:
It makes sense to me because Anyway, this means that either the documentation is wrong (and then I need to fix it) or the loader should resolve the path itself before requiring it (and then I need to fix it :D ). I'm not the most appropriate guy to take that kind of design decision about webpack (I barely use it), but my thought is that it should be possible to use a So I'm tempted to consider that the current design decision is the best one and that the documentation needs to be fixed. What do you think? |
Why use a path and not directly some js ? User could use require for file or node module. |
That was my first idea. It works perfectly when using "render at compile time" but when the template needs to be rendered at runtime, the environment used to compile it is needed in the bundle. And except if I'm wrong, the only way to have webpack include the environment into the bundle is to require it from its path in the loader output. This is done here: Line 53 in b20bf0e
Once again, there may be some better approach and I'm totally open to them. I'm currently looking at how other loaders deal with this - I know for sure that some forks of Edit: handlebars-loader also uses that approach when one want to provide a custom runtime. |
In this test project : https://github.com/ryuran/twing-loader-test
Twing loader fail to resolve
environmentModulePath
and do not findtwingEnv.js
.The text was updated successfully, but these errors were encountered: