From cdd3075e4f0d606bd119dbe3e2ddd7900b0bbf80 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Sat, 25 Nov 2023 08:27:43 +0500 Subject: [PATCH] mobile: fix webpack build --- .../app/components/dialog-provider/index.js | 1 - apps/mobile/native/webpack.config.js | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/apps/mobile/app/components/dialog-provider/index.js b/apps/mobile/app/components/dialog-provider/index.js index e62e5e442..2863aedd9 100644 --- a/apps/mobile/app/components/dialog-provider/index.js +++ b/apps/mobile/app/components/dialog-provider/index.js @@ -24,7 +24,6 @@ import { AnnouncementDialog } from "../announcements"; import AuthModal from "../auth/auth-modal"; import { SessionExpired } from "../auth/session-expired"; import { Dialog } from "../dialog"; -import { AddTopicDialog } from "../dialogs/add-topic"; import JumpToSectionDialog from "../dialogs/jump-to-section"; import { LoadingDialog } from "../dialogs/loading"; import PDFPreview from "../dialogs/pdf-preview"; diff --git a/apps/mobile/native/webpack.config.js b/apps/mobile/native/webpack.config.js index ab3ff4531..651715522 100644 --- a/apps/mobile/native/webpack.config.js +++ b/apps/mobile/native/webpack.config.js @@ -151,6 +151,29 @@ module.exports = (env) => { * https://github.com/babel/babel-loader#options */ rules: [ + { + test: /\.mjs$|cjs$|js$|jsx$|ts$|tsx$/, + include: [ + /node_modules(.*[/\\])+kysely/, + ], + use: { + loader: "babel-loader", + options: { + configFile: false, + cacheDirectory: path.join( + __dirname, + "node_modules/.webpack-cache" + ), + babelrc: false, + presets: ["module:metro-react-native-babel-preset"], + plugins: [ + "react-native-reanimated/plugin", + "@babel/plugin-transform-named-capturing-groups-regex", + ["@babel/plugin-transform-private-methods", { "loose": true }] + ] + }, + }, + }, { test: /\.mjs$|cjs$|js$|jsx$|ts$|tsx$/, include: [ @@ -186,8 +209,6 @@ module.exports = (env) => { /node_modules(.*[/\\])+@trpc[/\\]react-query/, /node_modules(.*[/\\])+katex/, /node_modules(.*[/\\])+@notesnook[/\\]core/, - /node_modules(.*[/\\])+kysely/, - ], use: { loader: "babel-loader", @@ -202,18 +223,11 @@ module.exports = (env) => { plugins: [ "react-native-reanimated/plugin", "@babel/plugin-transform-named-capturing-groups-regex", - ], - overrides: [ - { - test: '../node_modules/kysley', - plugins: [ - ["@babel/plugin-transform-private-methods", { "loose": true }] - ] - } ] }, }, }, + /** * Here you can adjust loader that will process your files. * @@ -248,6 +262,7 @@ module.exports = (env) => { }, }, }, + /** * This loader handles all static assets (images, video, audio and others), so that you can * use (reference) them inside your application.