0

I have a React project with TypeScript which is bootstrapped with create-react-app. I am using a separate file with .ts extension to declare types and interfaces. It looks like below.

export type TextFieldProps = {
  name: string;
  value: string;
  label: string;
};

My problem is if I change the type the compiler is not recompiling. If I change any other file it is working. I am expecting a solution without ejecting and adding config to the webpack manually. Can anyone help me to solve this without ejecting? Thanks in Advance.

2
  • What do you mean with if I change the type the compiler is not recompiling ? Commented Jul 15, 2019 at 9:46
  • I have a file where the TypeScript types are declared and this is imported to the component file and being used. Now if I change something in the Type file the compiler is not recompiling the application and nothing happened in the browser. Commented Jul 15, 2019 at 11:38

1 Answer 1

1

Two options that I can see:

1) Make your own watch task (with gulp, for example), which updates the web-page by running "npm run build".

2) Override create-react-app web-pack-config. Haven't done this myself, but I know that people do. This example looks promising: https://medium.com/@ryoldash/customize-webpack-config-of-react-app-created-with-create-react-app-7a78c7849edc

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.