forked from software-mansion/react-native-gesture-handler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
68 lines (67 loc) · 1.96 KB
/
webpack.config.js
File metadata and controls
68 lines (67 loc) · 1.96 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
64
65
66
67
68
const webpack = require('webpack');
const path = require('path');
module.exports = {
mode: 'development',
entry: ['@babel/polyfill', path.join(__dirname, 'index.web.js')],
output: {
path: path.join(__dirname, 'web'),
filename: 'app.bundle.js',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
// Usually react-native* and react-navigation* modules need compilation
exclude: /node_modules\/(?!react-native|@react-navigation|react-navigation)/,
use: {
loader: 'babel-loader',
options: {
babelrc: false,
configFile: false,
presets: [
'module:metro-react-native-babel-preset',
'@babel/preset-env',
],
plugins: [
'@babel/plugin-proposal-class-properties',
[
'module-resolver',
{
alias: {
'react-native-gesture-handler': '../',
react$: require.resolve('react'),
'react-native$': require.resolve('react-native-web'),
'react-dom$': require.resolve('react-dom'),
'react-art$': require.resolve('react-art'),
},
},
],
],
},
},
},
{
test: /\.(jpg|png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=1000000',
},
],
},
plugins: [
new webpack.DefinePlugin({
__DEV__: JSON.stringify(process.env.NODE_ENV === 'development'),
}),
],
resolve: {
// If you're working on a multi-platform React Native app, web-specific
// module implementations should be written in files using the extension
// '.web.js'.
symlinks: false,
extensions: ['.web.js', '.js'],
},
devServer: {
port: 8082,
contentBase: [path.join(__dirname, 'web'), path.join(__dirname, 'dist')],
historyApiFallback: true,
},
};