Created
July 19, 2022 11:16
-
-
Save ozcanzaferayan/e483006428c232176bdfed70836607c1 to your computer and use it in GitHub Desktop.
React Native Web Webpack 5 config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const HTMLWebpackPlugin = require('html-webpack-plugin'); | |
const HTMLWebpackPluginConfig = new HTMLWebpackPlugin({ | |
template: path.resolve(__dirname, './public/index.html'), | |
filename: 'index.html', | |
inject: 'body', | |
}); | |
module.exports = { | |
entry: path.join(__dirname, 'index.web.js'), | |
output: { | |
filename: 'bundle.js', | |
path: path.join(__dirname, '/build'), | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules\/(?!()\/).*/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['@babel/preset-react'], | |
}, | |
}, | |
}, | |
], | |
}, | |
plugins: [HTMLWebpackPluginConfig], | |
resolve: { | |
alias: { | |
'react-native$': 'react-native-web', | |
}, | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment