I have two different files tsconfig.json
and tsconfig.prod.json
and I'm trying to switch between these depending on whether webpack is run in development or production mode (-d/-p).
Here is my attempt at a webpack.config.js
, which doesn't work:
module.exports = {
entry: {
background: './src/background.ts',
popup: './src/popup.tsx',
'content-script': './src/content-script.ts'
},
output: {
filename: '[name].js',
path: path.resolve('extension-dist/js')
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'awesome-typescript-loader',
exclude: /node_modules/,
options: {
configFile: process.env.NODE_ENV === 'production' ?
path.resolve('./tsconfig.prod.json') :
path.resolve('./tsconfig.json')
}
}
]
},
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development'
};
But I'm still seeing this output from typescript even when running in production mode:
ℹ 「atl」: Using [email protected] from typescript
ℹ 「atl」: Using tsconfig.json from /twitter-extension/tsconfig.json