Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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.

--env.uglify and UI components #527

Copy link
Copy link
Open
@webleaf

Description

@webleaf
Issue body actions

I have such view xml file:

<Page class="page"
    xmlns="http://schemas.nativescript.org/tns.xsd"
    xmlns:lv="nativescript-ui-listview"
    loaded="onPageLoaded"
    navigatingTo="onNavigatingTo">
    <lv:RadListView items="{{ dataItems }}" loaded="onRadListViewLoaded" dataPopulated="onDataPopulated">
        <lv:RadListView.itemTemplate>
            <StackLayout orientation="vertical" info="test" tap="{{ $parents['RadListView'].addOnTop }}">
                <Label fontSize="20" text="{{ itemName }}"/>
                <Label fontSize="14" text="{{ itemDescription }}"/>
                <StackLayout height="1" backgroundColor="lightgray"/>
            </StackLayout>
        </lv:RadListView.itemTemplate>
    </lv:RadListView>
</Page>

And if I run $ tns run android --bundle --env.uglify, I get:

Binding: Property: 'addOnTop' is invalid or does not exist. SourceProperty: '$parents['RadListView'].addOnTop'

It's because RadListView name was minified to t. So i resolve it by editing webpack.config.js like this:

if (uglify) {
        config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));

        // Work around an Android issue by setting compress = false
        const compress = platform !== "android";
        config.plugins.push(new UglifyJsPlugin({
            uglifyOptions: {
                mangle: { reserved: nsWebpack.uglifyMangleExcludes.concat(["RadListView"]) }, // Deprecated. Remove if using {N} 4+.
                compress,
            }
        }));
    }

There are comment: // Deprecated. Remove if using {N} 4+.. But i have {N} 4. My package.json is:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.test",
    "tns-android": {
      "version": "4.0.1"
    }
  },
  "dependencies": {
    "nativescript-snackbar": "^3.0.0",
    "nativescript-sqlite": "^2.2.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-listview": "^3.5.6",
    "nativescript-ui-sidedrawer": "^4.1.0",
    "tns-core-modules": "^4.0.0"
  },
  "devDependencies": {
    "@types/node": "^10.0.5",
    "awesome-typescript-loader": "~3.1.3",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "clean-webpack-plugin": "~0.1.19",
    "copy-webpack-plugin": "~4.3.0",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.11.0",
    "nativescript-worker-loader": "~0.8.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.2.1",
    "tns-platform-declarations": "^4.0.0",
    "typescript": "^2.8.3",
    "uglifyjs-webpack-plugin": "~1.1.6",
    "webpack": "~3.10.0",
    "webpack-bundle-analyzer": "^2.9.1",
    "webpack-sources": "~1.1.0"
  }
}

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.