Skip to content

fix(webpack): bundling with uglify #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sdkAngular/app/app.module.ngfactory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* A dynamically generated module when compiled with AoT.
*/
export const AppModuleNgFactory: any;
12 changes: 0 additions & 12 deletions sdkAngular/app/vendor-platform.android.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
// Resolve JavaScript classes that extend a Java class, and need to resolve
// their JavaScript module from a bundled script. For example:
// NativeScriptApplication, NativeScriptActivity, etc.
//
// This module gets bundled together with the rest of the app code and the
// `require` calls get resolved to the correct bundling import call.
//
// At runtime the module gets loaded *before* the rest of the app code, so code
// placed here needs to be careful about its dependencies.

require("application");

if (!global["__snapshot"]) {
// In case snapshot generation is enabled these modules will get into the bundle
// but will not be required/evaluated.
// The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
// This way, they will be evaluated on app start as early as possible.

require("ui/frame");
require("ui/frame/activity");
require("./main-activity.android.ts");
Expand Down
3 changes: 3 additions & 0 deletions sdkAngular/app/vendor-platform.ios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files
// Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha nice

void 0;
15 changes: 7 additions & 8 deletions sdkAngular/app/vendor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Snapshot the ~/app.css and the theme
const application = require("application");
require("ui/styling/style-scope");
const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/);
global.registerWebpackModules(appCssContext);
application.loadAppCss();

require("./vendor-platform");

require("reflect-metadata");
Expand All @@ -11,11 +18,3 @@ require("@angular/router");
require("nativescript-angular/platform-static");
require("nativescript-angular/forms");
require("nativescript-angular/router");

require("nativescript-pro-ui/autocomplete/angular");
require("nativescript-pro-ui/calendar/angular");
require("nativescript-pro-ui/chart/angular");
require("nativescript-pro-ui/dataform/angular");
require("nativescript-pro-ui/gauges/angular");
require("nativescript-pro-ui/listview/angular");
require("nativescript-pro-ui/sidedrawer/angular");
23 changes: 12 additions & 11 deletions sdkAngular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@
},
"devDependencies": {
"@angular/compiler-cli": "~5.0.0",
"@ngtools/webpack": "~1.5.3",
"@ngtools/webpack": "~1.8.2",
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.0",
"chai": "^3.5.0",
"codelyzer": "^3.0.0",
"copy-webpack-plugin": "~4.0.1",
"extract-text-webpack-plugin": "3.0.0",
"css-loader": "~0.28.7",
"extract-text-webpack-plugin": "~3.0.0",
"filewalker": "0.1.3",
"karma": "^1.6.0",
"karma-chai": "^0.1.0",
Expand All @@ -55,25 +56,25 @@
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-typescript": "0.5.1",
"nativescript-dev-webpack": "next",
"nativescript-worker-loader": "~0.8.1",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.0.2",
"resolve-url-loader": "~2.1.0",
"tns-platform-declarations": "next",
"tslint": "^5.1.0",
"tslib": "1.7.1",
"tslint": "^5.1.0",
"typescript": "~2.4.2",
"webpack": "3.1.0",
"webpack": "~3.8.1",
"webpack-bundle-analyzer": "^2.8.2",
"webpack-sources": "~1.0.1",
"nativescript-worker-loader": "~0.8.1"
"webpack-sources": "~1.0.1"
},
"scripts": {
"ns-bundle": "ns-bundle",
"tslint": "tslint --project tsconfig.json --config tslint.json",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
"ns-bundle": "ns-bundle",
"start-android-bundle": "npm run ns-bundle --android --run-app",
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
"build-ios-bundle": "npm run ns-bundle --ios --build-app",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install"
}
}
39 changes: 0 additions & 39 deletions sdkAngular/tsconfig.aot.json

This file was deleted.

6 changes: 3 additions & 3 deletions sdkAngular/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"removeComments": false,
"watch": false,
"noLib": false,
"noEmitHelpers": true,
"preserveConstEnums": true,
"emitDecoratorMetadata": true,
"suppressImplicitAnyIndexErrors": true,
Expand All @@ -30,7 +31,6 @@
],
"exclude": [
"node_modules",
"platforms",
"**/*.aot.ts"
"platforms"
]
}
}
Loading