Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 如何将Typescript与React native绑定_Reactjs_Typescript_React Native_Webpack - Fatal编程技术网

Reactjs 如何将Typescript与React native绑定

Reactjs 如何将Typescript与React native绑定,reactjs,typescript,react-native,webpack,Reactjs,Typescript,React Native,Webpack,我正在尝试为react-native创建一个库,现在我使用typescript和react-native webview,但现在被困在使用webpack的捆绑包中。这是我的网页配置 module.exports = { mode: 'production', entry: './src/index.ts', externals: { 'react-native': true, }, module: { rules: [

我正在尝试为react-native创建一个库,现在我使用typescript和react-native webview,但现在被困在使用webpack的捆绑包中。这是我的网页配置

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: '',
    },
};
B.法律改革委员会

{
  "presets": [
    "@babel/preset-env",
    "module:metro-react-native-babel-preset"
  ]
}
我在运行
webpack build

ERROR in ./node_modules/react-native-webview/lib/WebView.js 7:36
Module 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)',
./node_modules/react native webview/lib/webview.js 7:36中的
错误
模块分析失败:意外令牌(7:36)
您可能需要适当的加载程序来处理此文件类型,目前没有配置加载程序来处理此文件。看见https://webpack.js.org/concepts#loaders
|//由Expo SDK 37.0.0.1实现生成的实现,带有
|//与本机接口类似。
>var WebView=函数(){return(