-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 expo - Knip fails to run in an Expo app with a configurable app.config.js
#919
Comments
Thanks @ronbraha. Yeah after I found out that it can be a function indeed I added a fix in 5.42.2. The provided rep(r)o has a Either way, any chance you're up for a PR to fix this? Apparently my attempt was too naive to fix all cases: knip/packages/knip/src/plugins/expo/index.ts Lines 24 to 25 in f9b0132
|
I can point out the problem and say it occurs because the referenced code here tries to call |
The Would be great if you could either 1) debug that using Knip in the production app, or 2) create a an actual reproduction of that situation I could look into. |
Experiencing the same issue. The first parameter in the app config function is of type |
Without a reproduction it's cumbersome to try and help out, but here's an attempt. Would be great if you could try it out and install this version of Knip:
|
just had same issue, PR above works for me |
@webpro your fix works for me in my expo project! |
Thanks for the quick fix! Analyzing workspace packages/native...
{}
root/app.config.js:59
plugins: [...config.plugins, getDummyPluginConfig()],
^
TypeError: config.plugins is not iterable
at module.exports (root/app.config.js:59:29)
at getConfig (file://root/node_modules/knip/dist/plugins/expo/helpers.js:11:60)
at Object.resolveEntryPaths (file://root/node_modules/knip/dist/plugins/expo/index.js:13:20)
at runPlugin (file://root/node_modules/knip/dist/WorkspaceWorker.js:247:85)
at async WorkspaceWorker.findDependenciesByPlugins (file:///node_modules/knip/dist/WorkspaceWorker.js:282:13)
at async main (file://root/node_modules/knip/dist/index.js:119:41)
at async run (file://root/node_modules/knip/dist/cli.js:26:83)
at async file://root/node_modules/knip/dist/cli.js:104:1
Node.js v20.10.0 For additional context, if the Here's an example of a "production" // app.json
{
"expo": {
"name": "MyApp",
"slug": "native",
"orientation": "portrait",
"newArchEnabled": true,
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover"
},
"scheme": "com.myapp.id",
"assetBundlePatterns": ["**/*"],
"ios": {
"associatedDomains": [
"applinks:app.domain.com",
"applinks:app.staging.com"
],
"supportsTablet": true,
"googleServicesFile": "path/to/GoogleServices.plist",
"bundleIdentifier": "com.myapp.id",
"entitlements": {
"aps-environment": "production"
}
},
"android": {
"permissions": [
"com.google.android.some-permission",
"android.permission.dummy"
],
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"googleServicesFile": "path/to/google-services.json",
"package": "com.myapp.id",
"intentFilters": [
{
"action": "VIEW",
"autoVerify": true,
"data": [
{
"scheme": "https",
"host": "app.myapp.com"
},
{
"scheme": "https",
"host": "app.staging.com"
}
],
"category": ["BROWSABLE", "DEFAULT"]
}
]
},
"web": {
"favicon": "./assets/favicon.png"
},
"plugins": [
"./plugins/some-plugin.js",
"./plugins/another-plugin.js",
"@some-package",
[
"expo-build-properties",
{
"ios": {
"useFrameworks": "static"
}
}
]
]
}
}
Here's an example of // app.config.js
// app.config.js schema: https://docs.expo.dev/versions/latest/config/app/
module.exports = ({ config }) => {
return {
...config,
version: APP_VERSION,
ios: {
...config.ios,
buildNumber: APP_BUILD_NUMBER,
},
android: {
...config.android,
versionCode: 7523649324,
},
plugins: [...config.plugins, getDummyPluginConfig()],
extra: {
environment: getEnvironment(),
},
};
}; feel free to use my attached repo reproduction as a baseline! |
Ah I'll fix that up and fall back to an empty array.
I know, but
|
🚀 This issue has been resolved in v5.43.6. See Release 5.43.6 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Hopefully things are better now! For any new issues, please open a new ticket. |
I can confirm that this works! thanks |
Prerequisites
Reproduction url
https://github.com/ronbraha/knip-expo-issue
Reproduction access
Description of the issue
Since version 5.42.0, Knip fails to run in an expo app with an
app.config.js
that accepts a function with a config object.The errors vary from version 5.42.0 to the latest (5.42.2), as there was an attempt to address this in the newest version.
This is what I see in 5.42.2 with a new app created with
create-expo-app
, and I experience the same issue in a production app:The text was updated successfully, but these errors were encountered: