Skip to content

Instantly share code, notes, and snippets.

@ozcanzaferayan
Created July 19, 2022 11:16
Show Gist options
  • Save ozcanzaferayan/e483006428c232176bdfed70836607c1 to your computer and use it in GitHub Desktop.
Save ozcanzaferayan/e483006428c232176bdfed70836607c1 to your computer and use it in GitHub Desktop.
React Native Web Webpack 5 config
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