From 78400e51fcb534cbd0ed8218faaa192ec77e9af1 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" <1474479+chenhunghan@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:10:29 +0800 Subject: [PATCH] Add babel-loader to fxi lingui related issues Signed-off-by: Hung-Han (Henry) Chen <1474479+chenhunghan@users.noreply.github.com> --- webpack.extensions.ts | 44 ++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/webpack.extensions.ts b/webpack.extensions.ts index ea56ad7c41..220f85a47a 100644 --- a/webpack.extensions.ts +++ b/webpack.extensions.ts @@ -31,18 +31,40 @@ export default function (): webpack.Configuration { rules: [ { test: /\.tsx?$/, - loader: "ts-loader", - options: { - transpileOnly: true, - // !! ts-loader will use tsconfig.json at folder root - // !! changes in tsconfig.json may have side effects - // !! on '@k8slens/extensions' module - compilerOptions: { - declaration: true, // output .d.ts - sourceMap: false, // to override sourceMap: true in tsconfig.json - outDir // where the .d.ts should be located + exclude: /node_modules/, + use: [ + { + loader: "babel-loader", + options: { + // for lingui + // https://lingui.js.org/guides/typescript.html + // just in case these are not in .babelrc + presets: [ + ["@babel/preset-env"], + ["@babel/preset-react"], + ["@lingui/babel-preset-react"] + ], + } + }, + { + loader: "ts-loader", + options: { + transpileOnly: true, + // !! ts-loader will use tsconfig.json at folder root + // !! changes in tsconfig.json may have side effects + // !! on '@k8slens/extensions' module + compilerOptions: { + declaration: true, // output .d.ts + sourceMap: false, // to override sourceMap: true in tsconfig.json + outDir, // where the .d.ts should be located + // for lingui + // https://lingui.js.org/guides/typescript.html + jsx: "preserve", + target: "es2016" + } + } } - } + ] }, // for src/renderer/components/fonts/roboto-mono-nerd.ttf // in src/renderer/components/dock/terminal.ts 95:25-65