-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathwebpack.config.mjs
46 lines (43 loc) · 1.08 KB
/
webpack.config.mjs
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
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import * as Repack from '@callstack/repack';
import TerserPlugin from 'terser-webpack-plugin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
/**
* Webpack configuration enhanced with Re.Pack defaults for React Native.
*
* Learn about webpack configuration: https://webpack.js.org/configuration/
* Learn about Re.Pack configuration: https://re-pack.dev/docs/guides/configuration
*/
export default {
context: __dirname,
entry: './index.js',
resolve: {
...Repack.getResolveOptions(),
},
module: {
rules: [
{
test: /\.[cm]?[jt]sx?$/,
use: 'babel-loader',
type: 'javascript/auto',
},
...Repack.getAssetTransformRules(),
],
},
optimization: {
minimizer: [
new TerserPlugin({
test: /\.(js)?bundle(\?.*)?$/i,
extractComments: false,
terserOptions: {
format: {
comments: false,
},
},
}),
],
},
plugins: [new Repack.RepackPlugin()],
};