Closed AmitDigga closed 3 years ago
Hi, closing this issue. Actually, the problem can be solved without macro. Instead of macro, I can create a normal babel plugin, and perform transformation with that plugin.
See https://github.com/kentcdodds/babel-plugin-macros/issues/186 for additional relevant information
babel-plugin-macros
version: 3.0.1node
version: v10.16.0npm
version: ...yarn
version: 1.16.0Relevant code or config
What you did:
I want an app where the user will write code having
MyMacro
in the textarea. I will usetransfromCode
function to apply macro and show if output code (code without macro)Used babel transform to transform macro code to normal code using
babel-plugin-macros
as plugin.What happened:
Unable to apply macro as some error related to
fs
package not being there or something else.Problem description:
Looks like when
transfrom
see's code withimport {MyMacro} '***.macro'
, it tries to load that macro file, but since it a react app in web, it is unable to usefs
to load that file and it causes problem.Suggested solution:
Out of ideas. Need help :(
I think a similar thing might be used by https://astexplorer.net/ to apply macro on the web. But it's too complicated for me to understand.