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.

Incorrect chunk produced when multiple files handled in the same compilation #767

@Mitko-Kerezov

Description

@Mitko-Kerezov

Describe the bug
Webpack build does not always produce/emit all necessary files whenever a name resolution (e.g. myfile.android.ts or myfile.ios.ts) needs to be applied and multiple files are saved simultaneously.
Note that this issue is only reproduced with an angular project.

To Reproduce

  1. tns create myProject --template tns-template-tab-navigation-ng
  2. cd myProject
  3. cp src/app/browse/browse.module.ts src/app/browse/browse.module.android.ts
  4. cp src/app/home/home.module.ts src/app/home/home.module.android.ts
  5. echo 'console.log("1111")' >> src/app/browse/browse.module.android.ts
  6. echo 'console.log("1111")' >> src/app/home/home.module.android.ts
  7. tns run android --bundle

After the initial run is done you should see

JS: 1111
JS: 1111

in the log.
Afterwards change both console.log statements in browse.module.android.ts and in home.module.android.ts to console.log("2222") and save them both at the same time. Webpack kicks in and builds but only 0.js is transferred to the device and the log states:

JS: 2222
JS: 1111

Expected behavior
The log should say

JS: 2222
JS: 2222

Additional context
According to my testing the issue only occurs in angular projects. And with webpack (--bundle).
I've tried with --bundle in a non-angular project but couldn't manage to reproduce it.
This issue only occurs if multiple files need to be compiled in the same batch (a single batch kicks in every 300 ms after the first change. This can be modified with this parameter) and at least one of them requires name resolution. The easiest way to put two files into the same batch is to save them at the same time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions