I'm trying to create a library for react-native, now I'm using typescript and react-native-webview but now stuck in bundle using webpack. Here is my webpack config
module.exports = { mode: 'production', entry: './src/index.ts', externals: {'react-native': true, }, module: { rules: [ { test: /\.(ts|tsx)?$/, include: path.resolve(__dirname, 'src'), use: [ { loader: 'babel-loader', }, ] }, ], }, resolve: { extensions: [ '.tsx', '.ts', '.js' ], }, output: { filename: 'index.js', path: path.resolve(__dirname, 'dist'), libraryTarget: 'umd', library: '', },};
.babelrc
{"presets": ["@babel/preset-env","module:metro-react-native-babel-preset" ]}
And I get this error when running webpack build
ERROR in ./node_modules/react-native-webview/lib/WebView.js 7:36Module parse failed: Unexpected token (7:36)You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders| // implementation which is produced by Expo SDK 37.0.0.1 implementation, with| // similar interface than the native ones have.> var WebView = function () { return (<View style={{| alignSelf: 'flex-start',| borderColor: 'rgb(255, 0, 0)',
Where is my wrong? Please help me