Skip to content

Symlinked directories causing infinite compile loop #94

@BenSjoberg

Description

@BenSjoberg

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.1.0
  • Cross-platform modules: 5.1.1
  • Android Runtime: 5.1.1
  • iOS Runtime: 5.1.1
  • Plugin(s): none

(Additional note: I've only tried this on macOS 10.14.)

Describe the bug

This issue is related to #85 and possibly connected to #53.

As documented in #85, there seems to be an issue with how chokidar is handling symlinked directories. For some reason, the glob isn't getting applied to files under symlinks - chokidar is firing events for any file change under a symlink. For example, if b is a link to a, changing a/example.ts will cause chokidar to report that b/example.ts has been modified, even though it obviously doesn't match the .s[ac]ss glob.

If a symlinked directory contains an SCSS file, this causes an infinite loop: when the compiler rewrites the CSS file, it triggers the watcher, causing the CSS file to be rewritten again, etc. The result is that tns run is totally unusable without --bundle if you have a symlinked directory containing SCSS files in your project.

I tried updating to chokidar 2.0.4 (2.0.2 is pinned currently), but no luck. This issue was reported to the chokidar devs last June but unfortunately they haven't gotten to it yet.

Until this is fixed in chokidar itself, a simple workaround is to verify the reported file paths actually match the .s[ac]ss glob before compiling. I tested this locally and it appears to fix the problem. I'll create a PR for this shortly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions