wix-incubator/react-templates

rt-include usage yields "RTCodeError: rt-include needs a readFileSync polyfill on options"

motin opened this issue · 3 comments

motin commented

Apparently readFileSync is necessary, and a polyfill should be included in "options", but how is this done and where? Docs would be great here :)

I think I've spotted a possible bug... are you running rt with no options at all?

motin commented

I run it (react-templates 0.5.4) via react-templates-loader 0.5.1 via the following loader config:

{
test: /.rt$/,
loader: "react-templates-loader?modules=amd",
exclude: /node_modules/
},

I guess this translates to "--modules amd" as command line options.

I think there's a a problem with the loader as it directly calls

reactTemplates.convertTemplateToReact(source, options);

but options.readFileSync is filled only when running rt from the CLI.

I think this line should be moved elsewhere, so to cover the non-CLI case as well.