W
W
Wasya UK2020-01-08 13:46:16
typescript
Wasya UK, 2020-01-08 13:46:16

How to build a specific folder in typescript?

There are 2 folders - client && server . I use typescript both there and there , but the client works through webpack , and the server through the tsc command. The tsconfig.json file is generic. When I try to build the server, the files from the client are also taken . It turns out that the entire src folder is in dist , but I don’t need this. And if you set --rootDir in the config, then when working with webpack I get an error that the path to the files with client is not set . File structure:

dist
src
--client
--server
tsconfig.json
webpack.config.json

How to use 1 tsconfig.json to change the file path to process a separate folder when rendering the server?
did not help:
"scripts": {
    "prod": "SET \"NODE_ENV=production\" && webpack --mode production", // тут клиент
    "build-server": "tsc --rootDir ./src/server" // тут ошибка (типа нету доступа к файлам с папки client)
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheBezik, 2020-01-09
@TheBezik

In tsconfig.json, you can add
"exclude" exceptions: ["server", "dist"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question