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

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

Closed
@sis0k0

Description

@sis0k0

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions