-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathrspack.config.ts
More file actions
63 lines (59 loc) · 1.84 KB
/
rspack.config.ts
File metadata and controls
63 lines (59 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import * as Repack from '@callstack/repack';
import rspack from '@rspack/core';
import getSharedDependencies from './sharedDeps.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* Rspack configuration enhanced with Re.Pack defaults for React Native.
*
* Learn about Rspack configuration: https://rspack.dev/config/
* Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
*/
const STANDALONE = Boolean(process.env.STANDALONE);
export default Repack.defineRspackConfig(({mode}) => {
return {
mode,
context: __dirname,
entry: './index.js',
resolve: {...Repack.getResolveOptions({enablePackageExports: true})},
output: {
uniqueName: 'sas-news',
},
module: {
rules: [
{
test: /\.[cm]?[jt]sx?$/,
use: {
loader: '@callstack/repack/babel-swc-loader',
parallel: true,
options: {},
},
type: 'javascript/auto',
},
...Repack.getAssetTransformRules({inline: true}),
],
},
plugins: [
new Repack.RepackPlugin(),
new Repack.plugins.ModuleFederationPluginV2({
name: 'news',
filename: 'news.container.js.bundle',
dts: false,
exposes: {
'./App': './src/navigation/MainNavigator',
},
shared: getSharedDependencies({eager: STANDALONE}),
}),
new Repack.plugins.CodeSigningPlugin({
enabled: mode === 'production',
privateKeyPath: path.join('..', '..', 'code-signing.pem'),
}),
// silence missing @react-native-masked-view optionally required by @react-navigation/elements
new rspack.IgnorePlugin({
resourceRegExp: /^@react-native-masked-view/,
}),
],
};
});