diff --git a/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap b/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap index b27f512ee..14e203797 100644 --- a/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap +++ b/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap @@ -358,9 +358,14 @@ export default function BoxWithButton(props) { exports[`amplify render tests custom render config should render common JS 1`] = ` "\\"use strict\\"; +var __importDefault = + (this && this.__importDefault) || + function (mod) { + return mod && mod.__esModule ? mod : { default: mod }; + }; Object.defineProperty(exports, \\"__esModule\\", { value: true }); /* eslint-disable */ -const react_1 = require(\\"react\\"); +const react_1 = __importDefault(require(\\"react\\")); const ui_react_1 = require(\\"@aws-amplify/ui-react\\"); function BoxWithButton(props) { return react_1.default.createElement( diff --git a/packages/studio-ui-codegen-react/lib/react-studio-template-renderer.ts b/packages/studio-ui-codegen-react/lib/react-studio-template-renderer.ts index 8221d021a..ea2aa4e7d 100644 --- a/packages/studio-ui-codegen-react/lib/react-studio-template-renderer.ts +++ b/packages/studio-ui-codegen-react/lib/react-studio-template-renderer.ts @@ -180,9 +180,12 @@ export abstract class ReactStudioTemplateRenderer extends StudioTemplateRenderer target, module, jsx: script === ScriptKind.JS ? ts.JsxEmit.React : ts.JsxEmit.Preserve, + esModuleInterop: true, }, }).outputText; + console.log(transpiledCode); + return prettier.format(transpiledCode, { parser: 'babel', plugins: [parserBabel] }); }