mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

Context loses imported file function after compiled

Open kingzez opened this issue 3 years ago • 0 comments

I am interested in helping provide a fix!

Yes

Which generators are impacted?

  • [X] All
  • [ ] Angular
  • [ ] HTML
  • [ ] Qwik
  • [ ] React
  • [ ] React-Native
  • [ ] Solid
  • [ ] Stencil
  • [ ] Svelte
  • [ ] Vue
  • [ ] Web components

Reproduction case

fiddle not support multi files

Expected Behaviour

  • utils/noop.ts
export default () => {}
  • group.context.lite.ts
import { createContext } from '@builder.io/mitosis'
import noop from './shared/utils/noop'

export default createContext({
  value: [],
  check: noop,
})
  • Vue group.context.ts
import noop from './shared/utils/noop'

const key = Symbol();

export default {
  CheckboxGroup: { value: [], check: noop },
  key,
};
  • React group.context.ts
import { createContext } from "react";
import noop from './shared/utils/noop';

export default createContext({
  value: [],
  check: noop,
});

noop should be import.

Actual Behaviour

  • Vue group.context.ts
const key = Symbol();

export default {
  CheckboxGroup: { value: [], check: noop },
  key,
};
  • React group.context.ts
import { createContext } from "react";

export default createContext({
  value: [],
  check: noop,
});

noop is not defined !!

Additional Information

No response

kingzez avatar Mar 01 '23 10:03 kingzez