I wrote Chrome Extensions, which gets App.tsx, and writes it to index.tsx. I'm trying to collect all this with the help of Craco and I get this error: Module not found: Error: Can't resolve 'react-native/Libraries/Image/AssetRegistry' in '/home/hodzhakhov/project/plugin/node_modules/expo-asset/build'. Moreover, all modules are installed in node_modules
Here is the file craco.config.js
const path = require('path');
const rootPath = path.join(__dirname, '..');
const webpack = require('webpack');
module.exports = {
webpack: {
configure: (webpackConfig, { env, paths }) => {
return {
...webpackConfig,
entry: {
main: [env === 'development' &&
require.resolve('react-dev-utils/webpackHotDevClient'),
paths.appIndexJs].filter(Boolean),
},
output: {
...webpackConfig.output,
filename: 'static/js/[name].js',
},
optimization: {
...webpackConfig.optimization,
runtimeChunk: false,
},
}
},
},
}
package.json
{
"name": "plugin",
"version": "1.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "INLINE_RUNTIME_CHUNK=false craco build",
"start": "INLINE_RUNTIME_CHUNK=false craco start"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@craco/craco": "^7.1.0",
"@types/chrome": "^0.0.253",
"@types/node": "^20.10.1",
"@types/react": "~18.2.14",
"@types/react-native": "^0.72.7",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"babel-plugin-module-resolver": "^5.0.0",
"eslint": "^8.48.0",
"eslint-config-universe": "^12.0.0",
"eslint-plugin-valtio": "^0.6.2",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"dependencies": {
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@expo/webpack-config": "^19.0.0",
"@react-navigation/bottom-tabs": "^6.5.9",
"@react-navigation/native": "^6.1.7",
"@react-navigation/stack": "^6.3.17",
"@reduxjs/toolkit": "^1.9.5",
"expo": "~49.0.8",
"expo-document-picker": "~11.2.2",
"expo-image-picker": "~14.1.1",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"expo-web-browser": "~12.3.2",
"firebase": "^10.6.0",
"lodash": "^4.17.21",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.4",
"react-native-chart-kit": "^6.12.0",
"react-native-gesture-handler": "~2.12.0",
"react-native-linear-gradient": "^2.8.3",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-svg": "^13.14.0",
"react-native-uuid": "^2.0.1",
"react-native-web": "^0.19.9",
"react-redux": "^8.1.2",
"react-refresh": "^0.14.0",
"react-scripts": "^5.0.1",
"redux": "^4.2.1",
"redux-batched-subscribe": "^0.1.6",
"redux-logger": "^3.0.6",
"redux-saga": "^1.2.3",
"redux-thunk": "^2.4.2",
"valtio": "^1.11.2"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Error in file AssetRegistry.js Could not find a declaration file for module '@react-native/assets-registry/registry'. '/home/hodzhakhov/work/project/plugin/node_modules/@react-native/assets-registry/registry.js' implicitly has an 'any' type.
Also in the @react-native/assets-registry/registry file.js VS Code also throws an error Type aliases can only be used in TypeScript files.
I tried to do what VS Code suggests: Try npm i --save-dev @types/react-native__assets-registry
if it exists or add a new declaration (.d.ts) file containing declare module '@react-native/assets-registry/registry';
But it didn't help