Files
react-native-svg/Example/webpack.config.js
T
Lenz Weber-TronicandGitHub afaf500db9 make reanimated work in web (#1886)
Up until now, trying to use reanimated with react-native-svg in react-native-web resulted in an error.
This adds a setNativeProps function to the web implementation to directly modify the transform and style props on a SVGElement ref.

Since there is a need to track the "last merged props" and those need to be reset on every render, the render method has been moved into the WebShape class and a tag string property has been added.

As g had some extra handling for x and y, a prepareProps function was added as well.
2022-10-13 14:07:20 +02:00

58 lines
1.2 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'),
fromRoot('node_modules/react-native-reanimated'),
],
},
{
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',
],
},
plugins: [new (require('webpack').DefinePlugin)({process: {env: {}}})],
};