我按照这个tutorial添加react-native-web
到react-native
项目。但我得到了错误时,添加react-native-vector-icons
到项目。
./node_modules/react-native-vector-icons/lib/create-icon-set.js
SyntaxError: /home/hamidreza/Desktop/myApp/node_modules/react-native-vector-icons/lib/create-icon-set.js: Support for the experimental syntax 'classProperties' isn't currently enabled (43:22):
41 |
42 | class Icon extends PureComponent {
> 43 | static propTypes = {
| ^
44 | allowFontScaling: PropTypes.bool,
45 | name: IconNamePropType,
46 | size: PropTypes.number,
我还将我的babel.config.js
更改为:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
],
};
或
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
'@babel/plugin-proposal-class-properties'
],
};
但还是有问题。
我该怎么办?
1条答案
按热度按时间vhipe2zx1#
通过添加
到
babelLoaderConfiguration
的问题已解决。最终
web/webpack.config.js
: