forked from zoontek/react-native-bootsplash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
50 lines (48 loc) · 1.26 KB
/
webpack.config.js
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
// https://necolas.github.io/react-native-web/docs/multi-platform/#compiling-and-bundling
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const fromRoot = (_) => path.resolve(__dirname, _);
module.exports = {
mode: "development",
entry: fromRoot("index.js"),
output: {
path: fromRoot("dist"),
filename: "bundle.web.js",
},
devServer: {
static: { directory: fromRoot("dist") },
devMiddleware: { publicPath: "/" },
},
plugins: [
new HtmlWebpackPlugin({
template: fromRoot("index.html"),
}),
],
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
use: { loader: "babel-loader" },
include: [fromRoot("index.js"), fromRoot("src")],
},
{
test: /\.(png|jpe?g|gif)$/,
loader: "react-native-web-image-loader",
options: { esModule: false, scalings: { "@2x": 2, "@3x": 3 } },
},
{
test: /\.(svg)$/,
use: {
loader: "url-loader",
options: { esModule: false },
},
},
],
},
resolve: {
alias: { "react-native$": "react-native-web" },
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"]
.map((extension) => [".web" + extension, extension])
.flat(),
},
};