mobile: fix webpack build

This commit is contained in:
Ammar Ahmed
2023-11-25 08:27:43 +05:00
committed by Abdullah Atta
parent 162d16b2c7
commit cdd3075e4f
2 changed files with 25 additions and 11 deletions

View File

@@ -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";

View File

@@ -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.