You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great tool, thanks for it. There's one thing though: when the code to be prevaled in template tags requires a module, that module won't be transpiled by babel. For example, this code that prerenders a react element:
even though react preset is added to babel configuration.
The simplest solution is to add require("babel-register"); at the top of a template literal. However, it would be nice if this package could handle this automatically.
Suggested solution:
Prepend transpiled with "require("babel-register");\n" before passing it to requireFromString at
babel-plugin-preval
version: ^1.6.3node
version: ^9npm
(oryarn
) version: ^1Great tool, thanks for it. There's one thing though: when the code to be prevaled in template tags requires a module, that module won't be transpiled by babel. For example, this code that prerenders a react element:
will fail with error:
even though
react
preset is added to babel configuration.The simplest solution is to add
require("babel-register");
at the top of a template literal. However, it would be nice if this package could handle this automatically.Suggested solution:
Prepend
transpiled
with"require("babel-register");\n"
before passing it torequireFromString
atbabel-plugin-preval/src/get-replacement.js
Line 10 in 36de84a
The text was updated successfully, but these errors were encountered: