Skip to content

Commit

Permalink
Fix fetch in React Native
Browse files Browse the repository at this point in the history
  • Loading branch information
karampitsos committed Sep 9, 2024
1 parent 2d65671 commit 20c87c6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"license": "Apache-2.0",
"main": "dist/node.native.js",
"browser": "dist/browser.native.js",
"react-native": "dist/react-native.native.js",
"types": "dist/node.native.d.ts",
"publishConfig": {
"access": "public"
Expand Down
2 changes: 2 additions & 0 deletions packages/native/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const nodeConfig = require('./webpack.node');
const browserConfig = require('./webpack.browser');
const reactNativeConfig = require('./webpack.react-native');

module.exports = [
nodeConfig,
browserConfig,
reactNativeConfig,
];
37 changes: 37 additions & 0 deletions packages/native/webpack.react-native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const path = require('path');
const { DefinePlugin } = require('webpack');
const { version } = require('./package.json');

module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: './src/index.js',
output: {
globalObject: 'global',
path: path.resolve(__dirname, 'dist'),
filename: 'react-native.native.js',
library: 'Transifex',
},
target: 'web',
devtool: 'source-map',
plugins: [
new DefinePlugin({
__VERSION__: JSON.stringify(version),
__PLATFORM__: JSON.stringify('react-native'),
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [['@babel/transform-runtime']],
},
},
},
],
},
};

0 comments on commit 20c87c6

Please sign in to comment.