Reputation: 11475
I might be missing something, but when I run webpack I would expect it to end with error code upon TypeScript error, but it only prints error into console, in red, but only prints, therefor our build passes, but the webpage won't have any JS.
webpack.config.js
// imports...
module.exports = {
mode: 'development',
target: 'web',
entry: { ... },
output: { ... },
resolve: {
modules: [TypeScriptSourceDir, nodeModules],
extensions: ['.ts'],
},
module: {
rules: [
...
{
// compile and transpile .ts files
test: /\.ts(x?)$/,
include: TypeScriptSourceDir,
use: [{
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
}, {
loader: 'awesome-typescript-loader',
options: {
context: path.join(TypeScriptSourceDir, 'video'),
configFileName,
useBabel: true,
useCache: true,
}
}],
},
]
},
};
Simple error like const a: number = '0'
will be printed in build, but won't end webpack with error and JS won't be created.
Upvotes: 0
Views: 2208
Reputation: 483
I believe that by default, webpack will complete it's build with an exit code of 0 unless you specify for it not too. Check out this thread of Github: https://github.com/TypeStrong/ts-loader/issues/108#issuecomment-177046587. Looks like you can throw in an optional conifg in your webpack.config.js
Upvotes: 1