Browse Source

chore(ts): Update webpack to include babel-loader in tandem with ts-loader (#14226)

Alberto Leal 5 years ago
parent
commit
c5304e3039
2 changed files with 14 additions and 3 deletions
  1. 2 1
      tsconfig.json
  2. 12 2
      webpack.config.js

+ 2 - 1
tsconfig.json

@@ -9,7 +9,8 @@
     "allowJs": false,
     "noImplicitAny": false,
     "esModuleInterop": true,
-    "module": "commonjs",
+    "module": "esnext",
+    "moduleResolution": "node",
     "jsx": "react",
     "baseUrl": ".",
     "outDir": "src/sentry/static/sentry/dist",

+ 12 - 2
webpack.config.js

@@ -172,6 +172,8 @@ const cacheGroups = {
   ...localeChunkGroups,
 };
 
+const babelOptions = {...babelConfig, cacheDirectory: true};
+
 /**
  * Main Webpack config for Sentry React SPA.
  */
@@ -187,14 +189,22 @@ const appConfig = {
         exclude: /(vendor|node_modules|dist)/,
         use: {
           loader: 'babel-loader',
-          options: {...babelConfig, cacheDirectory: true},
+          options: babelOptions,
         },
       },
       {
         test: /\.tsx?$/,
         include: [staticPrefix],
         exclude: /(vendor|node_modules|dist)/,
-        loader: 'ts-loader',
+        use: [
+          {
+            loader: 'babel-loader',
+            options: babelOptions,
+          },
+          {
+            loader: 'ts-loader',
+          },
+        ],
       },
       {
         test: /\.po$/,