Reputation: 61
My folder structure is the following:
src
└> index.ts
└> image.webp
└> test.html
└> something.css
build
└> index.js
tsconfig.json
As you may see, in my build folder, there is only the built index File, but not my WEBP, HTML and CSS files, which I want to be in the build folder though.
Is there a way to do that?
My current tsconfig.json:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"removeComments": true,
"typeRoots": ["@types"],
"outDir": "build"
},
"exclude": ["node_modules"],
"include": ["src"]
}
Upvotes: 0
Views: 1230
Reputation: 111
This has a solution by @bencergazda, he has created typescript-cp that works exactly like you would have hoped.
It works in parallel with typescript and it reads your tsconfig.
I installed it globally on my machine as it is available on npm and just ran "tsc" to do the initial copy build, then I add script with "tsc -w && tscp -w" to have typescript work in parallel with typescript-cp.
Upvotes: 0
Reputation: 1081
I believe it is not possible with tsconfig
You could try to write a build script with copyfiles
"build": "npm-run-all build:*",
"build:lib": "tsc",
"build:asset": "copyfiles image.webp test.html some.css build",
You could also achieve the same with webpack
and CopyPlugin
Upvotes: 1