extractBundledAssets() does not extract subfolders recursively
the-unknown opened this issue · 3 comments
Hey,
I ran into strange behavior regarding asset-bundling.
It seems that extractBundledAssets()
will not extract sub-folders recursively.
This is my assets-folder structure:
As you can see, there is a _next
sub-folder inside of webroot
, as I want to use a NextJS application.
However, when I call await extractBundledAssets(fileDir, 'webroot');
it will not extract the _next
sub-folder at all!
This is my code:
if (extract) {
await unlink(fileDir);
console.log('Extracting web server assets...');
await extractBundledAssets(fileDir, 'webroot');
}
This is the content of build.gradle
sourceSets {
main {
assets.srcDirs = [
'../../assets',
]
}
}
This is the result.
emu64xa:/data/user/0/com.change.myexpoapp/files/webroot $ ls -al
total 104
drwx------ 2 u0_a197 u0_a197 4096 2023-10-19 06:41 .
drwxrwx--x 3 u0_a197 u0_a197 4096 2023-10-19 06:50 ..
-rwx------ 1 u0_a197 u0_a197 7258 2023-10-19 06:41 404.html
-rwx------ 1 u0_a197 u0_a197 25931 2023-10-19 06:41 favicon.ico
-rwx------ 1 u0_a197 u0_a197 6327 2023-10-19 06:41 index.html
-rwx------ 1 u0_a197 u0_a197 3280 2023-10-19 06:41 index.txt
-rwx------ 1 u0_a197 u0_a197 11399 2023-10-19 06:41 mobile_logo.jpg
-rwx------ 1 u0_a197 u0_a197 5 2023-10-19 06:41 version
Not sure why... it works recursively in my own projects.
You know, the function is very simple, and implemented in TypeScript layer:
react-native-static-server/src/index.tsx
Lines 398 to 412 in 142eded
why you just don't add some debug output directly into its source, within your
node_modules
, and figure out what is wrong there? Is there anything special about that folder, maybe asset.isDirectory()
for some reason fails to classify it is as a directory?ok, so I debugged this and it appears that a directory that starts with a "_" does not get recognized as directory and is just ignored.
When I rename it from _next
to next
it works.
This might be an issue with react-native-fs
I guess.
Yeah, it looks so, I should look into it in my fork of RNFS. Thanks for noticing it :)