Using TypeScript on your POWER web hosting plan
Find out how to use TypeScript on your POWER web hosting plan
Find out how to use TypeScript on your POWER web hosting plan
Last updated 4th February 2021
You've subscribed to a Web POWER web hosting plan to deploy Node.js applications, and you want to deploy TypeScript code.
This guide will explain how to do it.
Find out how to install Strapi on your POWER web hosting plan.
If you have just started to use your Web POWER web hosting plan, we suggest to have a look at our Getting started with a POWER web hosting plan guide before going further.
TypeScript projects can't run directly by our stack, they should be compiled to JS first.
You should include typescript as dev dependency module for your project:
npm add --save-dev typescript
Create a tsconfig.json
(if you don't have one already) with the following content for example (see the TypeScript doc for more information):
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"rootDir": "./",
"outDir": "./build",
"esModuleInterop": true,
"strict": true
}
}
Build the project, either directly with tsc
command:
npx tsc --project ./
or by adding the build script to the package.json
:
"scripts": {
"build": "tsc --project ./"
},
and executing it with npm run build
.
Your entrypoint should point to the one in your output dir, for example :
ln -s build/server.js server.js
Join our community of users on https://community.ovh.com/en/.
Join our Gitter room to discuss directly with the POWER Web Hosting team and the other users of this lab.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community