From 47d3813b7dacdace09b4430cfa2ce238dd78a988 Mon Sep 17 00:00:00 2001 From: jhovanyamaya Date: Fri, 24 Feb 2017 16:00:57 -0500 Subject: [PATCH] Cambios en ts loader para evitar problema con la recarga de los archivos. - Agrega tsconfig. - Agrega webpack-fail plugin para propagar error cuando se presente uno (https://github.com/TypeStrong/ts-loader#failing-the-build-on-typescript-compilation-error). --- package.json | 6 +++--- tsconfig.json | 10 ++++++++++ webpack.config.js | 29 ++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 tsconfig.json diff --git a/package.json b/package.json index fc32932..bdf2048 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,12 @@ "rx": "^4.1.0" }, "devDependencies": { - "awesome-typescript-loader": "^3.0.4", - "json-loader": "^0.5.4", "source-map-loader": "^0.1.6", + "ts-loader": "^2.0.1", "typescript": "^2.1.6", "webpack": "^2.2.1", - "webpack-dev-server": "^2.4.1" + "webpack-dev-server": "^2.4.1", + "webpack-fail-plugin": "^1.0.5" }, "config": {} } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..2b16cfa --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "outDir": "./dist/", + "sourceMap": true, + "noImplicitAny": false, + "module": "commonjs", + "target": "es5", + "allowJs": true + } +} diff --git a/webpack.config.js b/webpack.config.js index 618a6fd..c400a2c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,19 +1,30 @@ +const path = require('path'); +const failPlugin = require('webpack-fail-plugin'); + module.exports = { - entry: "./src/index.ts", + entry: './src/index.ts', + output: { - filename: "./dist/bundle.js", + path: path.resolve(__dirname, 'dist'), + filename: 'bundle.js', libraryTarget: "umd", library: "kafkaesque-ui" + }, + devtool: "source-map", - resolve: { - extensions: [".webpack.js", ".web.js", ".ts", ".tsx", ".js"] - }, module: { - loaders: [ - { test: /\.tsx?$/, loader: "awesome-typescript-loader" }, - { test: /\.json$/, loader: 'json' } + rules: [ + {test: /\.tsx?$/, loader: 'ts-loader', exclude: /node_modules/} ] - } + }, + + resolve: { + extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'] + }, + + plugins: [ + failPlugin + ] }; \ No newline at end of file