0

I have a Vue project that I created with the Vue CLI, and I now want to enable TypeScript on the project. I took a look at this guide, but it recommends adding a Webpack config and replacing vue-cli-service in the package.json scripts section with Webpack.

Is there any way I can continue to use vue-cli-service to build my Vue app and enable TypeScript support for it?

3 Answers 3

1

With an existing Vue CLI project, you can add TypeScript support by entering this command:

vue add typescript

Beware that this command will overwrite files, but you can use git diff to view the differences.

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

Comments

0

In vue-cli 3.x

$ vue create <app_name>

This will bring up a prompt, select Manually select features, enable TypeScript using the space bar. It will automatically configure everything for you.

1 Comment

This is an existing app though. Is there any way to change the settings after setup?
0

I ended up generating a new vue project using vue cli with typescript enabled and copied the tsconfig and added the packages missing in my package.json

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.