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

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

Open
1 task
CatchABus opened this issue Jul 7, 2020 · 0 comments
Open
1 task

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

CatchABus opened this issue Jul 7, 2020 · 0 comments

Comments

@CatchABus
Copy link

CatchABus commented Jul 7, 2020

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant