Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Running app with --path and --env.snapshot fails #584

Closed
1 task done
sis0k0 opened this issue Jun 25, 2018 · 0 comments · Fixed by #586
Closed
1 task done

Running app with --path and --env.snapshot fails #584

sis0k0 opened this issue Jun 25, 2018 · 0 comments · Fixed by #586
Assignees
Labels

Comments

@sis0k0
Copy link
Contributor

sis0k0 commented Jun 25, 2018

Issue Checklist

  • You are submitting: bug

Tell us about the problem

The following command fails:

tns run android --bundle --env.snapshot --path testapp

with:

ENOENT: no such file or directory, open 'platforms/android/app/snapshot-entry.js'

Reasons for failure

The nativescript-dev-webpack has a before-watchPatterns hook. Its job is to tell the {N} CLI what files are watched by the webpack watcher and should be ignored by the CLI watcher. The hook does the following:

  1. Calls the project data service from {N} CLI to determine what are the source dir and app resources dir.
  2. Requires the webpack config file and passes the above as arguments.
  3. Gets the compilation context from the returned webpack config object and tells the {N} CLI that it shouldn't bother with watching anything in that compilation context. The default compilation context is the source directory.

The problem arises when the webpack config file is required. When the --env.snapshot flag is passed, the NativeScriptSnapshotPlugin is instantiated. That has a side effect - a file, named snapshot-entry.js is created inside the native Android project. This fails when we invoke the tns run command outside of the project, because the specified path for the created file is relative.

Proposed solution

Stop requiring the webpack config file in the hook, because that may have side effects. Instead tell the {N} CLI watcher to ignore the whole source dir.

@sis0k0 sis0k0 added the bug label Jun 25, 2018
@sis0k0 sis0k0 self-assigned this Jun 25, 2018
sis0k0 added a commit that referenced this issue Jun 25, 2018
…ges (#586)

Stop requiring the webpack config file in the hook, because that may have side effects. Instead tell the {N} CLI watcher to ignore the whole source dir.

fixes #584
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
1 participant