やtsconfig.json
などの環境固有の設定方法はありますか?tsconfig.prod.json
tsconfig.dev.json
sourceMap
開発環境ではと を保持したいのですcomments
が、本番環境ではこれらを削除したいと思います。
ベストアンサー1
これに使えますextends
。
例:tsconfig.prod.json
{
"extends": "./tsconfig",
"compilerOptions": {
"sourceMap": "false"
}
}
を使用する場合はwebpack
、ts-loader
次のように設定できます。
https://github.com/TypeStrong/ts-loader#configfile-string-defaulttsconfigjson
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: ['react-hot-loader/babel'],
},
},
{
loader: 'ts-loader',// (or awesome-typescript-loader)
options: {
configFile: 'tsconfig.prod.json'
},
},
],
},