├── src ├── app │ ├── components │ │ ├── home │ │ │ ├── home.css │ │ │ ├── home.html │ │ │ └── home.ts │ │ ├── about │ │ │ ├── about.css │ │ │ ├── about.html │ │ │ └── about.ts │ │ ├── repo-list │ │ │ ├── repo-list.css │ │ │ ├── repo-list.html │ │ │ └── repo-list.ts │ │ ├── repo-browser │ │ │ ├── repo-browser.css │ │ │ ├── repo-browser.html │ │ │ └── repo-browser.ts │ │ └── repo-detail │ │ │ ├── repo-detail.css │ │ │ ├── repo-detail.html │ │ │ └── repo-detail.ts │ ├── index.ts │ ├── app.html │ ├── services │ │ └── github.ts │ ├── app.css │ └── app.component.ts ├── favicon.ico ├── index.html ├── polyfills-browser.ts ├── main-browser.ts └── custom-typings.d.ts ├── .gitignore ├── typings.json ├── .editorconfig ├── tsconfig.json ├── README.md ├── LICENSE ├── package.json └── webpack.config.js /src/app/components/home/home.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/about/about.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/repo-list/repo-list.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/repo-browser/repo-browser.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/components/repo-detail/repo-detail.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/index.ts: -------------------------------------------------------------------------------- 1 | export * from './app.component'; 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /dist/ 3 | /npm-debug.log 4 | /typings/ 5 | -------------------------------------------------------------------------------- /src/app/components/home/home.html: -------------------------------------------------------------------------------- 1 |

Home Component

2 |

Welcome to Angular Seed

-------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PatrickJS/angular2-webpack2-seed/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/app/components/about/about.html: -------------------------------------------------------------------------------- 1 |

About Component

2 |

This is the about component!

-------------------------------------------------------------------------------- /src/app/components/repo-detail/repo-detail.html: -------------------------------------------------------------------------------- 1 |

{{ repoDetails.full_name }}

2 | 3 |
this.repoDetails = {{ repoDetails | json }}
4 | -------------------------------------------------------------------------------- /src/app/components/repo-browser/repo-browser.html: -------------------------------------------------------------------------------- 1 |

GitHub Browser

2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/app/components/repo-list/repo-list.html: -------------------------------------------------------------------------------- 1 |

Repo list

2 | 9 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": {}, 3 | "ambientDependencies": { 4 | "es6-collections": "registry:dt/es6-collections#0.5.1+20160316155526", 5 | "es6-promise": "registry:dt/es6-promise#0.0.0+20160423074304", 6 | "node": "registry:dt/node#4.0.0+20160412142033" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | insert_final_newline = false 15 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Angular2 Seed 6 | 7 | 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/app/components/home/home.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'home', 5 | template: require('./home.html'), 6 | styles: [ 7 | require('./home.css') 8 | ], 9 | providers: [], 10 | directives: [], 11 | pipes: [] 12 | }) 13 | export class Home { 14 | 15 | constructor() {} 16 | 17 | ngOnInit() { 18 | 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/app/app.html: -------------------------------------------------------------------------------- 1 |

2 | Angular 2 Seed 3 |

4 | 17 | 18 |
19 | 20 |
21 | 22 | 23 | 26 | -------------------------------------------------------------------------------- /src/polyfills-browser.ts: -------------------------------------------------------------------------------- 1 | // Polyfills 2 | // These modules are what's in angular 2 bundle polyfills so don't include them 3 | // import 'es6-shim'; 4 | // import 'es6-promise'; 5 | // import 'reflect-metadata'; 6 | 7 | // CoreJS has all the polyfills you need 8 | 9 | import 'core-js/es6'; 10 | import 'core-js/es7/reflect'; 11 | import 'ts-helpers'; 12 | require('zone.js/dist/zone'); 13 | // require('zone.js/dist/long-stack-trace-zone'); 14 | -------------------------------------------------------------------------------- /src/app/components/about/about.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Http} from '@angular/http'; 3 | 4 | 5 | @Component({ 6 | selector: 'about', 7 | template: require('./about.html'), 8 | styles: [ 9 | require('./about.css') 10 | ], 11 | providers: [], 12 | directives: [], 13 | pipes: [] 14 | }) 15 | export class About { 16 | 17 | constructor(public http: Http) { 18 | 19 | } 20 | 21 | ngOnInit() { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "outDir": "dist", 6 | "rootDir": ".", 7 | "sourceMap": true, 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "noEmitHelpers": true 11 | }, 12 | "exclude": [ 13 | "typings/main.d.ts", 14 | "typings/main", 15 | "node_modules" 16 | ], 17 | "compileOnSave": false, 18 | "buildOnSave": false, 19 | "atom": { "rewriteTsconfig": false } 20 | } 21 | -------------------------------------------------------------------------------- /src/main-browser.ts: -------------------------------------------------------------------------------- 1 | import {Component, enableProdMode} from '@angular/core'; 2 | import {ROUTER_PROVIDERS} from '@angular/router-deprecated'; 3 | import {HTTP_PROVIDERS} from '@angular/http'; 4 | import {enableDebugTools} from '@angular/platform-browser'; 5 | import {bootstrap} from '@angular/platform-browser-dynamic'; 6 | 7 | import {App} from './app/index'; 8 | 9 | enableProdMode(); 10 | 11 | bootstrap(App, [ 12 | ...HTTP_PROVIDERS, 13 | ...ROUTER_PROVIDERS 14 | ]) 15 | .then(ref => (enableDebugTools(ref), ref)); 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## angular2-webpack2-seed 2 | 3 | A simple starter project demonstrating the basic concepts of Angular 2 with Webpack 2. 4 | 5 | This branch uses [Webpack 2](https://webpack.github.io/). 6 | 7 | ### Usage 8 | - Clone or fork this repository 9 | - Make sure you have [node.js](https://nodejs.org/) installed 10 | - run `npm install -g webpack webpack-dev-server typings typescript ts-node` to install global dependencies 11 | - run `npm install` to install dependencies 12 | - run `npm run start:prod && npm run server:prod` to fire up dev server 13 | - open browser to [`http://localhost:8080`](http://localhost:8080) 14 | -------------------------------------------------------------------------------- /src/app/components/repo-list/repo-list.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Github} from '../../services/github'; 3 | import {Observable} from 'rxjs/Observable'; 4 | import {RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; 5 | 6 | @Component({ 7 | selector: 'repo-list', 8 | template: require('./repo-list.html'), 9 | styles: [ 10 | require('./repo-list.css') 11 | ], 12 | providers: [], 13 | directives: [ ROUTER_DIRECTIVES ], 14 | pipes: [] 15 | }) 16 | export class RepoList { 17 | repos: Observable; 18 | constructor(public github: Github, public params: RouteParams) {} 19 | 20 | ngOnInit() { 21 | this.repos = this.github.getReposForOrg(this.params.get('org')); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/app/components/repo-detail/repo-detail.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {RouteParams, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; 3 | import {Http} from '@angular/http'; 4 | import {Github} from '../../services/github'; 5 | 6 | @Component({ 7 | selector: 'repo-detail', 8 | template: require('./repo-detail.html'), 9 | styles: [ 10 | require('./repo-detail.css') 11 | ], 12 | providers: [], 13 | directives: [ ROUTER_DIRECTIVES ], 14 | pipes: [] 15 | }) 16 | export class RepoDetail { 17 | repoDetails = {}; 18 | constructor(public routeParams: RouteParams, public github: Github) {} 19 | 20 | ngOnInit() { 21 | this.github.getRepoForOrg(this.routeParams.get('org'), this.routeParams.get('name')) 22 | .subscribe(repoDetails => { 23 | this.repoDetails = repoDetails; 24 | }); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/app/services/github.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {Http, URLSearchParams} from '@angular/http'; 3 | import 'rxjs/add/operator/map'; 4 | 5 | @Injectable() 6 | export class Github { 7 | constructor(private http: Http) {} 8 | 9 | getOrg(org: string) { 10 | return this.makeRequest(`orgs/${org}`); 11 | } 12 | 13 | getReposForOrg(org: string) { 14 | return this.makeRequest(`orgs/${ org }/repos`); 15 | } 16 | 17 | getRepoForOrg(org: string, repo: string) { 18 | return this.makeRequest(`repos/${ org }/${ repo }`); 19 | } 20 | 21 | private makeRequest(path: string) { 22 | let params = new URLSearchParams(); 23 | params.set('per_page', '100'); 24 | 25 | let url = 'https://api.github.com/' + path; 26 | return this.http 27 | .get(url, {search: params}) 28 | .map((res) => res.json()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/app/app.css: -------------------------------------------------------------------------------- 1 | import {Component} from '@igorminar/core'; 2 | import {Router, RouteConfig, ROUTER_DIRECTIVES} from '@igorminar/router'; 3 | 4 | import {Home} from './components/home/home'; 5 | import {About} from './components/about/about'; 6 | import {RepoBrowser} from './components/repo-browser/repo-browser'; 7 | 8 | @Component({ 9 | selector: 'app', 10 | providers: [], 11 | pipes: [], 12 | directives: [ ROUTER_DIRECTIVES ], 13 | template: require('./app.template.html'), 14 | }) 15 | @RouteConfig([ 16 | { 17 | path: '/home', 18 | component: Home, 19 | name: 'Home', 20 | useAsDefault: true 21 | }, 22 | { 23 | path: '/about', 24 | name: 'About', 25 | loader: () => System.import('./components/about/about').then(cmp => cmp.About) 26 | }, 27 | { 28 | path: '/github/...', 29 | component: RepoBrowser, 30 | name: 'RepoBrowser' 31 | }, 32 | ]) 33 | export class App { 34 | 35 | constructor() {} 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Router, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; 3 | 4 | import {Home} from './components/home/home'; 5 | import {About} from './components/about/about'; 6 | import {RepoBrowser} from './components/repo-browser/repo-browser'; 7 | 8 | @Component({ 9 | selector: 'app', 10 | providers: [], 11 | pipes: [], 12 | directives: [ ROUTER_DIRECTIVES ], 13 | styles: [ 14 | require('./app.css') 15 | ], 16 | template: require('./app.html'), 17 | }) 18 | @RouteConfig([ 19 | { 20 | path: '/home', 21 | component: Home, 22 | name: 'Home', 23 | useAsDefault: true 24 | }, 25 | { 26 | path: '/about', 27 | name: 'About', 28 | loader: () => System.import('./components/about/about').then(cmp => cmp.About) 29 | }, 30 | { 31 | path: '/github/...', 32 | component: RepoBrowser, 33 | name: 'RepoBrowser' 34 | }, 35 | ]) 36 | export class App { 37 | 38 | constructor() {} 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/custom-typings.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Custom Type Definitions 3 | * When including 3rd party modules you also need to include the type definition for the module 4 | * if they don't provide one within the module. You can try to install it with typings 5 | 6 | typings install node --save 7 | 8 | * If you can't find the type definition in the registry we can make an ambient definition in 9 | * this file for now. For example 10 | 11 | declare module "my-module" { 12 | export function doesSomething(value: string): string; 13 | } 14 | 15 | * 16 | * If you're prototying and you will fix the types later you can also declare it as type any 17 | * 18 | 19 | declare var assert: any; 20 | 21 | * 22 | * If you're importing a module that uses Node.js modules which are CommonJS you need to import as 23 | * 24 | 25 | import * as _ from 'lodash' 26 | 27 | * You can include your type definitions in this file until you create one for the typings registry 28 | * see https://github.com/typings/registry 29 | * 30 | */ 31 | 32 | 33 | declare var System: any; 34 | -------------------------------------------------------------------------------- /src/app/components/repo-browser/repo-browser.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Router, RouteConfig, ROUTER_DIRECTIVES} from '@angular/router-deprecated'; 3 | 4 | import {RepoList} from '../repo-list/repo-list'; 5 | import {RepoDetail} from '../repo-detail/repo-detail'; 6 | import {Github} from '../../services/github'; 7 | 8 | @Component({ 9 | selector: 'repo-browser', 10 | template: require('./repo-browser.html'), 11 | styles: [ 12 | require('./repo-browser.css') 13 | ], 14 | providers: [ Github ], 15 | directives: [ ROUTER_DIRECTIVES ], 16 | pipes: [] 17 | }) 18 | @RouteConfig([ 19 | {path: '/:org', component: RepoList, name: 'RepoList'}, 20 | {path: '/:org/:name', component: RepoDetail, name: 'RepoDetail' }, 21 | ]) 22 | export class RepoBrowser { 23 | 24 | constructor(private router: Router, private github: Github) {} 25 | 26 | searchForOrg(orgName: string) { 27 | this.github.getOrg(orgName) 28 | .subscribe(({name}) => { 29 | console.log(name); 30 | this.router.navigate(['RepoList', {org: orgName}]); 31 | }); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2015-2016 Google, Inc, AngularClass, LLC. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular2-webpack2-seed", 3 | "version": "2.0.0", 4 | "description": "A simple starter Angular2 project", 5 | "scripts": { 6 | "typings-install": "node node_modules/typings/dist/bin.js install", 7 | "postinstall": "npm run typings-install", 8 | "build": "node node_modules/webpack/bin/webpack.js --inline --color --progress --display-error-details --display-cached", 9 | "prebuild:prod": "rimraf dist", 10 | "build:prod": "node node_modules/webpack/bin/webpack.js --progress --color --display-error-details --display-cached --display-reasons", 11 | "watch": "npm run build -- --watch", 12 | "watch:prod": "npm run build:prod -- --watch", 13 | "server": "node node_modules/webpack-dev-server/bin/webpack-dev-server.js --open --inline", 14 | "server:prod": "http-server dist --cors", 15 | "start": "npm run server", 16 | "start:watch": "concurrently 'npm run server:prod' 'npm run watch:prod'" 17 | }, 18 | "contributors": [ 19 | "PatrickJS " 20 | ], 21 | "license": "MIT", 22 | "devDependencies": { 23 | "compression-webpack-plugin": "^0.3.1", 24 | "concurrently": "^2.0.0", 25 | "es6-promise": "3.0.2", 26 | "es6-shim": "0.35.0", 27 | "html-webpack-plugin": "^2.16.0", 28 | "json-loader": "^0.5.4", 29 | "raw-loader": "^0.5.1", 30 | "reflect-metadata": "0.1.2", 31 | "rimraf": "^2.5.2", 32 | "source-map-loader": "^0.1.5", 33 | "ts-loader": "^0.8.2", 34 | "ts-node": "^0.7.2", 35 | "typescript": "^1.8.10", 36 | "typings": "~0.8.1", 37 | "webpack": "2.1.0-beta.6", 38 | "webpack-dev-server": "2.0.0-beta", 39 | "webpack-md5-hash": "0.0.5", 40 | "webpack-merge": "^0.8.4" 41 | }, 42 | "dependencies": { 43 | "@angular/http": "0.0.0-7", 44 | "@angular/common": "0.0.0-7", 45 | "@angular/compiler": "0.0.0-7", 46 | "@angular/core": "0.0.0-7", 47 | "@angular/platform-browser": "0.0.0-7", 48 | "@angular/platform-browser-dynamic": "0.0.0-7", 49 | "@angular/platform-server": "0.0.0-7", 50 | "@angular/router": "0.0.0-7", 51 | "@angular/router-deprecated": "0.0.0-7", 52 | "core-js": "^2.2.0", 53 | "http-server": "^0.9.0", 54 | "rxjs": "~5.0.0-beta.2", 55 | "ts-helpers": "^1.1.0", 56 | "zone.js": "~0.6.12" 57 | }, 58 | "keywords": [ 59 | "Angular2", 60 | "angular2-seed", 61 | "official angular 2 seed", 62 | "official angular2 seed" 63 | ], 64 | "repository": { 65 | "type": "git", 66 | "url": "git+https://github.com/gdi2290/angular2-webpack2-seed.git" 67 | }, 68 | "bugs": { 69 | "url": "https://github.com/gdi2290/angular2-webpack2-seed/issues" 70 | }, 71 | "homepage": "https://github.com/gdi2290/angular2-webpack2-seed#readme" 72 | } 73 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var path = require('path'); 3 | 4 | var CompressionPlugin = require('compression-webpack-plugin'); 5 | var HtmlWebpackPlugin = require('html-webpack-plugin'); 6 | var WebpackMd5Hash = require('webpack-md5-hash'); 7 | 8 | // Webpack Configr build 9 | var webpackConfig = { 10 | entry: { 11 | 'polyfills': './src/polyfills-browser.ts', 12 | 'main': './src/main-browser.ts', 13 | }, 14 | 15 | output: { 16 | path: './dist', 17 | }, 18 | 19 | module: { 20 | loaders: [ 21 | // .ts files for TypeScript 22 | { test: /\.ts$/, loader: 'ts-loader' }, 23 | // .json files for json files 24 | { test: /\.json$/, loader: 'json-loader' }, 25 | // .html files for json files 26 | { test: /\.html$/, loader: 'raw-loader' }, 27 | // .css files for json files 28 | { test: /\.css$/, loader: 'raw-loader' }, 29 | 30 | 31 | ] 32 | }, 33 | 34 | plugins: [ 35 | new HtmlWebpackPlugin({ 36 | template: 'src/index.html', 37 | chunksSortMode: packageSort(['polyfills', 'main']) 38 | }), 39 | new WebpackMd5Hash(), 40 | new webpack.optimize.DedupePlugin(), 41 | // new webpack.optimize.UglifyJsPlugin(), 42 | new webpack.LoaderOptionsPlugin({ 43 | minimize: true, 44 | debug: false 45 | }), 46 | new CompressionPlugin({ 47 | asset: '[path].gz[query]', 48 | algorithm: 'gzip', 49 | threshold: 10240, 50 | minRatio: 0.8, 51 | regExp: /\.css$|\.html$|\.js$|\.map$/, 52 | threshold: 2 * 1024 53 | }), 54 | new webpack.DefinePlugin({ 55 | 'isDart': false, 56 | 'process.env': { 57 | 'NODE_ENV': JSON.stringify('production') 58 | } 59 | }), 60 | ], 61 | 62 | }; 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | // Our Webpack Defaults 81 | var defaultConfig = { 82 | devtool: 'source-map', 83 | // devtool: 'cheap-module-eval-source-map', 84 | cache: false, 85 | 86 | output: { 87 | filename: '[name].[hash].bundle.js', 88 | sourceMapFilename: '[name].[hash].map', 89 | chunkFilename: '[id].[hash].chunk.js' 90 | }, 91 | 92 | module: { 93 | preLoaders: [ 94 | { 95 | test: /\.js$/, 96 | loader: 'source-map-loader', 97 | exclude: [ 98 | // these packages have problems with their sourcemaps 99 | path.join(__dirname, 'node_modules', 'rxjs'), 100 | path.join(__dirname, 'node_modules', '@angular2-material'), 101 | path.join(__dirname, 'node_modules', '@angular'), 102 | ] 103 | } 104 | ], 105 | noParse: [ 106 | path.join(__dirname, 'node_modules', 'zone.js', 'dist'), 107 | path.join(__dirname, 'node_modules', 'angular2', 'bundles'), 108 | path.join(__dirname, 'node_modules', 'ts-helpers'), 109 | ] 110 | }, 111 | 112 | mainFields: ['jsnext:main', 'main', 'browser'], 113 | resolve: { 114 | root: [ path.join(__dirname, 'src') ], 115 | extensions: ['', '.ts', '.js', '.json'], 116 | packageMains: ['jsnext:main', 'main', 'browser'], 117 | // alias: { 118 | // '@igorminar/core': path.resolve(__dirname, 'node_modules/@igorminar/core/esm/core.js'), 119 | // '@igorminar/platform-browser': path.resolve(__dirname, 'node_modules/@igorminar/platform-browser/esm/platform_browser.js'), 120 | // '@igorminar/router': path.resolve(__dirname, 'node_modules/@igorminar/router/esm/router.js'), 121 | // '@igorminar/http': path.resolve(__dirname, 'node_modules/@igorminar/http/esm/http.js') 122 | // }, 123 | }, 124 | 125 | devServer: { 126 | historyApiFallback: true, 127 | watchOptions: { aggregateTimeout: 300, poll: 1000 } 128 | }, 129 | 130 | 131 | node: { 132 | global: 1, 133 | crypto: 'empty', 134 | module: 0, 135 | Buffer: 0, 136 | clearImmediate: 0, 137 | setImmediate: 0 138 | }, 139 | } 140 | 141 | var webpackMerge = require('webpack-merge'); 142 | module.exports = webpackMerge(defaultConfig, webpackConfig); 143 | 144 | function packageSort(packages) { 145 | // packages = ['polyfills', 'vendor', 'main'] 146 | var len = packages.length - 1; 147 | var first = packages[0]; 148 | var last = packages[len]; 149 | return function sort(a, b) { 150 | // polyfills always first 151 | if (a.names[0] === first) { 152 | return -1; 153 | } 154 | // main always last 155 | if (a.names[0] === last) { 156 | return 1; 157 | } 158 | // vendor before app 159 | if (a.names[0] !== first && b.names[0] === last) { 160 | return -1; 161 | } else { 162 | return 1; 163 | } 164 | } 165 | } 166 | 167 | function reverse(arr) { 168 | return arr.reverse(); 169 | } 170 | --------------------------------------------------------------------------------