From 248dc5b10b2518ae550da405d9b9cfabda2eda6a Mon Sep 17 00:00:00 2001 From: "Val Erastov (xibyte)" Date: Wed, 6 May 2020 01:26:07 -0700 Subject: [PATCH] enable typescript for webpack --- .babelrc | 7 +++++-- package-lock.json | 5 ----- package.json | 1 + tsconfig.json | 17 +++++++++++++++++ webpack.config.js | 4 ++-- 5 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 tsconfig.json diff --git a/.babelrc b/.babelrc index 67ed1b73..ee9bbff2 100644 --- a/.babelrc +++ b/.babelrc @@ -1,7 +1,10 @@ { - "presets": ["@babel/env", "@babel/react", "@babel/flow"], + "presets": ["@babel/typescript", "@babel/env", "@babel/react", "@babel/flow"], "plugins": [ ["@babel/plugin-proposal-decorators", { "legacy": true }], - "@babel/proposal-class-properties" + "@babel/proposal-class-properties", + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining" + ] } diff --git a/package-lock.json b/package-lock.json index 2c0713ce..9d4ea0af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4082,11 +4082,6 @@ "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", "dev": true }, - "diff-match-patch": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/diff-match-patch/-/diff-match-patch-1.0.0.tgz", - "integrity": "sha1-HMPIOkkNZ/ldkeOfatHy4Ia2MEg=" - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", diff --git a/package.json b/package.json index f0742971..4e8f744f 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "less": "^3.11.1", "libtess": "1.2.2", "lodash": "^4.17.15", + "marked": "^1.0.0", "mousetrap": "1.6.1", "numeric": "1.2.6", "prop-types": "15.6.0", diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..8ff2e1e4 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "lib": ["es2018", "dom"], + "sourceMap": true, + "jsx": "react", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "target": "ES5", + "baseUrl": ".", + "paths": { + "*": [ + "modules/*", + "node_modules/*" + ] + } + } +} diff --git a/webpack.config.js b/webpack.config.js index b6e4d2bb..d7c011a9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -29,7 +29,7 @@ module.exports = { new webpack.HotModuleReplacementPlugin(), ], resolve: { - extensions: ['.js', '.jsx'], + extensions: ['.js', '.jsx', ".ts", ".tsx"], modules: [MODULES, "node_modules"] }, devServer: { @@ -48,7 +48,7 @@ module.exports = { }, module: { rules: [{ - test: /\.(js|jsx)$/, + test: /\.(js|jsx|ts|tsx)$/, loader: 'babel-loader', include: [MODULES, WEB_APP, INTEGRATION_TESTS] }, {