Files
react-native-svg/Example/webpack.config.js
Mathieu Acthernoene 2fa9645cf6 Add web example (#1717)
Added web example to `Example`
2022-03-07 12:16:50 +01:00

56 lines
1.1 KiB
JavaScript

'use strict';
const path = require('path');
const fromRoot = _ => path.resolve(__dirname, _);
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: fromRoot('index.js'),
output: {
path: fromRoot('dist'),
filename: 'bundle.web.js',
},
devServer: {
static: {directory: fromRoot('dist')},
devMiddleware: {publicPath: '/'},
},
module: {
rules: [
{
test: /\.(jsx?|tsx?)$/,
use: {loader: 'babel-loader'},
include: [
fromRoot('index.js'),
fromRoot('src'),
fromRoot('node_modules/react-native-svg'),
],
},
{
test: /\.(gif|jpe?g|png)$/i,
use: [
{
loader: 'file-loader',
options: {esModule: false},
},
],
},
],
},
resolve: {
symlinks: false,
alias: {
'react-native$': 'react-native-web',
},
extensions: [
'.web.ts',
'.ts',
'.web.tsx',
'.tsx',
'.web.js',
'.js',
'.web.jsx',
'.jsx',
],
},
};