You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Application with at least one plugin that requires the CLI to generate aar file. For example - the sdk samples that use the nativescript-camera plugin.
Command:
First case (webpack):
tns run android --bundle
Second case (no webpack):
tns run android
Behavior
First case (webpack)
When you change a file in the node_modules/ folder, for example node_modules/tns-core-modules/bundle-entry-points.js:
The mtime (modified time) of the file is updated.
Webpack detects the change and recompiles the JS bundles (for example, bundle.js or vendor.js). Then it starts the livesync process.
The CLI detects that there was a change in node_modules.
Because of the change in node_modules, the modulesChanged flag is raised and the CLI regenerates all aar files. see here
The changed JS file is deployed on the device and the app is restarted/refreshed.
Second case (no webpack)
You have to make two file changes here, because the CLI keeps track of the mtimes of the files in node_modules, but the watcher detects changes only in the app/ folder.
[User action] Modify a file in node_modules, for example - node_modules/tns-core-modules/bundle-entry-points.js.
The mtime of the file is updated.
[User action] Modify a file in the app/ folder, for example - app/app.css.
The CLI watcher detects that there is a change in the app/ folder and starts the livesync process, which includes preparing the project.
The CLI detects that there was a change in node_modules.
Because of the change in node_modules, the modulesChanged flag is raised and the CLI regenerates all aar files. see here
The changed JS bundles are deployed on the device and the app is restarted.
Expected behavior
The CLI should keep track of node_modules only when the sync-all-files flag is used. Checking for modified files in node_modules on every change can be quite slow.
Note: Rebuilding the aar files for every change in node_modules (even if that's done only when using the sync-all-files flag) is also slow and not necessary. This probably should be logged as separate issue. @rosen-vladimirov, what do you think?
Why does this happen?
Currently, the node_modules are traversed and checked for modified files explicitly. That's because of this change: 04f9737#diff-919912d52b0e0303e76febe7c84cacfdR67.
If we get the old code back, the CLI will only check node_modules when the --sync-all-files flag is provided.
Cons of the proposed change
If we stop keeping track of node_modules when using normal livesync or livesync with bundle, we will lose the following functionality:
Adding a new NativeScript plugin that doesn't have a prebuilt aar file will not work until you stop the CLI process and run a clean build.
Modifying the native files (platform/android) of a plugin in node_modules won't rebuild its aar file until you stop the CLI process and run a clean build.
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
CLI: 4.2.0-2018-06-26-11829 (the same thing happens with the official version - 4.1.2)
The text was updated successfully, but these errors were encountered:
I'm adding some more use-cases here that describe the same behavior and that will be fixed in #3750 :
In case any file is modified in the <project dir>/node_modules/<nativescript plugin>/platforms/android , CLI rebuilds all .aar files of the plugins. This can be easily reproduced with this project (follow the README.md for detailed description): https://github.com/rosen-vladimirov/project-local-plugins
In fact only the modified plugins should be rebuild.
NOTE: The changes introduce in #3711 caused additional issues - with them changes in node_modules are never prepared (i.e. they are not moved to <project dir>/platforms/... directory as CLI does not check node_modules unless --syncAllFiles is passed. As we do not want to pass --syncAllFiles to prepare, build, test, etc. commands, the #3750 fixes this behavior as well.
Please, provide the details below:
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
👍
Tell us about the problem
Setup:
Application with at least one plugin that requires the CLI to generate aar file. For example - the sdk samples that use the
nativescript-camera
plugin.Command:
First case (webpack):
Second case (no webpack):
Behavior
First case (webpack)
When you change a file in the
node_modules/
folder, for examplenode_modules/tns-core-modules/bundle-entry-points.js
:mtime
(modified time) of the file is updated.bundle.js
orvendor.js
). Then it starts the livesync process.node_modules
, themodulesChanged
flag is raised and the CLI regenerates all aar files. see hereSecond case (no webpack)
You have to make two file changes here, because the CLI keeps track of the
mtimes
of the files innode_modules
, but the watcher detects changes only in theapp/
folder.node_modules
, for example -node_modules/tns-core-modules/bundle-entry-points.js
.mtime
of the file is updated.app/
folder, for example -app/app.css
.app/
folder and starts the livesync process, which includes preparing the project.node_modules
, themodulesChanged
flag is raised and the CLI regenerates all aar files. see hereExpected behavior
The CLI should keep track of
node_modules
only when thesync-all-files
flag is used. Checking for modified files innode_modules
on every change can be quite slow.Why does this happen?
Currently, the
node_modules
are traversed and checked for modified files explicitly. That's because of this change: 04f9737#diff-919912d52b0e0303e76febe7c84cacfdR67.If we get the old code back, the CLI will only check node_modules when the
--sync-all-files
flag is provided.Cons of the proposed change
If we stop keeping track of
node_modules
when using normal livesync or livesync with bundle, we will lose the following functionality:platform/android
) of a plugin innode_modules
won't rebuild its aar file until you stop the CLI process and run a clean build.Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
The text was updated successfully, but these errors were encountered: