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.

[BUG] TerserPlugin breaks $parents["typeName"] functionality #1142

Open
@CatchABus

Description

@CatchABus

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: 6.7.4

  • Cross-platform modules: 6.5.8

  • Android Runtime: 6.5.1

  • iOS Runtime: 6.5.1

  • Plugin(s):

  • Node.js: 12.16.3

  • Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack

Describe the bug
When using --env.uglify, Terser Plugin minifies class and function names. As a result, NativeScript's $parents[] references inside XML files are broken since they use component class names to get distant parent (e.g. $parents["Frame"]).
All in all, after minimizing, 'Frame' will be called 'e' but $parents[] will still try to look for 'Frame'.

To Reproduce
Add $parents["typeName"] references inside page view.
Execute 'tns run --env.uglify'

Expected behavior
Class and Function names should be kept as is and $parents[] references should work properly.

Additional context
In the past, I submitted a bug report regarding this issue in NS repository but I didn't know what the cause of it is.
NativeScript/NativeScript#8541

If the following properties are set in TerserPlugin, inside 'terserOptions' and 'compress' objects, problem will be solved.

keep_classnames: true,
keep_fnames: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions