ruby - Need to render as a UMD module - rails-babel-transpiler gem -
i using rails-babel-transpiler gem mentioned in official babel site language api - ruby, converting es6 code es5.
the way transpiling, below erb file
<% require 'babel/transpiler' transfromed = babel::transpiler.transform("import hellowrapper '../assets/javascripts/components/hellowrapper'; reactdom.render(<hellowrapper />, document.getelementbyid('app'));") %> <%= javascript_tag %> <%= transfromed["code"].html_safe %> <% end %>
it getting rendered
//<![cdata[ 'use strict'; function _interoprequiredefault(obj) { return obj && obj.__esmodule ? obj : { 'default': obj }; } var _assetsjavascriptscomponentshellowrapper = require('../assets/javascripts/components/hellowrapper'); var _assetsjavascriptscomponentshellowrapper2 = _interoprequiredefault(_assetsjavascriptscomponentshellowrapper); reactdom.render(react.createelement(_assetsjavascriptscomponentshellowrapper2['default'], null), document.getelementbyid('app')); //]]>
can above code rendered in umd way? have used plugin "transform-es2015-modules-umd" in babelrc file not getting converted umd module. me in figuring out! thanks
Comments
Post a Comment