Skip to content

Instantly share code, notes, and snippets.

@lukashlobil
Last active April 17, 2017 15:05
Show Gist options
  • Save lukashlobil/a46096353401ba1ec4108f8215a519d1 to your computer and use it in GitHub Desktop.
Save lukashlobil/a46096353401ba1ec4108f8215a519d1 to your computer and use it in GitHub Desktop.
Webpack config
import {platformNativeScriptDynamic} from 'nativescript-angular/platform';
import {Config} from './shared/config/config';
//This is in a separate file, because we might want to do more configuration like setting pro mode on or enable additional logging
Config.platform = 'mobile';
//do NOT move this line, needs to be just before the bootstrap, otherwise it will compile before your config
import {NativeModule} from './native.module';
import {isIOS} from 'platform';
declare var GMSServices: any;
if (isIOS) {
GMSServices.provideAPIKey('longkey');
}
platformNativeScriptDynamic().bootstrapModule(NativeModule);
//native script & angular
import {NativeScriptModule} from 'nativescript-angular/platform'; //this line always first !
import {NativeScriptFormsModule} from 'nativescript-angular/forms';
import {NativeScriptHttpModule} from 'nativescript-angular/http';
import {NativeScriptRouterModule} from 'nativescript-angular/router';
import {NgModule, APP_INITIALIZER, OpaqueToken, LOCALE_ID, NO_ERRORS_SCHEMA} from '@angular/core';
import {RouterExtensions} from 'nativescript-angular/router/router-extensions';
import {registerElement} from 'nativescript-angular/element-registry';
//plugins
import {LISTVIEW_DIRECTIVES} from 'nativescript-telerik-ui/listview/angular';
import {SIDEDRAWER_DIRECTIVES} from 'nativescript-telerik-ui/sidedrawer/angular';
import {TNSFontIconModule} from 'nativescript-ng2-fonticon';
//core
import {NativeAppComponent} from './app.component';
import {routes, navigatableComponents} from './app.routes';
registerElement('DropDown', () => require('nativescript-drop-down/drop-down').DropDown);
registerElement('Slide', () => require('nativescript-slides').Slide);
registerElement('SlideContainer', () => require('nativescript-slides').SlideContainer);
// general modules
export const API_ARTICLE = new OpaqueToken('api.article');
export function contextLoad(contexts: Contexts) {
contexts.init();
}
export function apiArticle(api: Api) {
return new CrudApi('articles/article', api);
}
@NgModule({
schemas: [NO_ERRORS_SCHEMA],
imports: [
//all modules go here
NativeScriptModule,
NativeScriptHttpModule,
NativeScriptRouterModule,
NativeScriptRouterModule.forRoot(routes),
TNSFontIconModule.forRoot({
'flaticon': 'flaticon.css'
})
],
declarations: [
//every directive usable in app needs to go here, specific directives go to specific modules
...navigatableComponents,
NativeAppComponent,
LISTVIEW_DIRECTIVES, SIDEDRAWER_DIRECTIVES,
SideMenu, Toolbar,
],
providers: [
// app-wide services
RouterExtensions,
{provide: LOCALE_ID, useValue: 'cs-CZ'},
],
bootstrap: [NativeAppComponent]
})
export class NativeModule {}
{
"nativescript": {
"id": "come.something.else",
"tns-android": {
"version": "2.4.0"
},
"tns-ios": {
"version": "2.4.0"
}
},
"scripts": {
"clean": "rm -rf platforms node_modules lib hooks",
"clean-android": "tns clean-app android",
"clean-ios": "tns clean-app ios",
"prewebpack-android": "npm run clean-android",
"prewebpack-ios": "npm run clean-ios",
"webpack-android": "webpack --config=webpack.android.js --progress",
"webpack-ios": "webpack --config=webpack.ios.js --progress",
"prestart-android-bundle": "npm run webpack-android",
"prestart-ios-bundle": "npm run webpack-ios",
"start-android-bundle": "tns run android --bundle --disable-npm-install",
"start-ios-bundle": "tns run ios --bundle --disable-npm-install",
"prebuild-android-bundle": "npm run webpack-android",
"prebuild-ios-bundle": "npm run webpack-ios",
"build-android-bundle": "tns build android --bundle --disable-npm-install",
"build-ios-bundle": "tns build ios --bundle --disable-npm-install"
},
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"@ngrx/core": "1.2.0",
"@ngrx/store": "2.2.1",
"es6-promise": "3.0.2",
"es6-shim": "0.35.0",
"lodash": "4.16.4",
"moment": "2.15.0",
"nativescript-angular": "1.3.0-2016-12-06-1124",
"nativescript-camera": "0.0.8",
"nativescript-drop-down": "1.3.2",
"nativescript-geolocation": "0.0.12",
"nativescript-google-maps-sdk": "1.4.1",
"nativescript-ng2-fonticon": "1.3.2",
"nativescript-orientation": "1.5.3",
"nativescript-slides": "2.2.2",
"nativescript-telerik-ui": "next",
"nativescript-theme-core": "1.0.0",
"nativescript-toasts": "1.0.2",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.12",
"tns-core-modules": "2.4.3"
},
"devDependencies": {
"@types/lodash": "^4.14.40",
"babel-traverse": "6.12.0",
"babel-types": "6.11.1",
"babylon": "6.8.4",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"nativescript-dev-typescript": "0.3.2",
"nativescript-dev-webpack": "0.2.15",
"shelljs": "0.7.0",
"tslint": "^3.14.0",
"typescript": "2.0.8",
"zone.js": "^0.6.21",
"webpack": "~2.1.0-beta.27",
"copy-webpack-plugin": "~3.0.1",
"raw-loader": "~0.5.1",
"css-loader": "~0.26.0",
"resolve-url-loader": "~1.6.0",
"extract-text-webpack-plugin": "~2.0.0-beta.4",
"@angular/compiler-cli": "2.2.1",
"@ngtools/webpack": "1.1.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment