{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/729","repository_url":"https://api.github.com/repos/systemjs/builder","labels_url":"https://api.github.com/repos/systemjs/builder/issues/729/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/729/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/729/events","html_url":"https://github.com/systemjs/builder/issues/729","id":187378206,"number":729,"title":"How to create bundles in case of lazy loading modules?","user":{"login":"smartm0use","id":5399265,"avatar_url":"https://avatars.githubusercontent.com/u/5399265?v=3","gravatar_id":"","url":"https://api.github.com/users/smartm0use","html_url":"https://github.com/smartm0use","followers_url":"https://api.github.com/users/smartm0use/followers","following_url":"https://api.github.com/users/smartm0use/following{/other_user}","gists_url":"https://api.github.com/users/smartm0use/gists{/gist_id}","starred_url":"https://api.github.com/users/smartm0use/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartm0use/subscriptions","organizations_url":"https://api.github.com/users/smartm0use/orgs","repos_url":"https://api.github.com/users/smartm0use/repos","events_url":"https://api.github.com/users/smartm0use/events{/privacy}","received_events_url":"https://api.github.com/users/smartm0use/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":29,"created_at":"2016-11-04T16:25:32Z","updated_at":"2016-11-08T15:16:20Z","closed_at":null,"body":"Hello,\r\ncan you please help me at this?\r\n\r\nI have some modules in my Angular2 app and in the router configuration i use lazy loading to open them.\r\n\r\nHere is a routing file of my app that lazy loads two modules:\r\n\r\n\tconst appRoutes: Routes = [\r\n\t\t{ path: '', component: MainComponent,\r\n\t\t    canActivate: [AuthGuard],\r\n\t\t    children: [\r\n\t\t        { path: 'dashboard', component: DashboardComponent },\r\n\t\t        { path: 'first-section', loadChildren: 'app/modules/FIRST-SECTION/first-section.module' },\r\n\t\t        { path: 'second-section', loadChildren: 'app/modules/SECOND-SECTION/second-section.module' },\r\n\t\t        { path: 'documents', component: DocumentsComponent },\r\n\t\t        { path: 'users', component: UsersComponent },\r\n\t\t        { path: '', redirectTo: 'dashboard', pathMatch: 'full' }\r\n\t\t    ]\r\n\t\t}\r\n\t];\r\n\r\nI use Gulp to create dev and build tasks. For the build i created the following task:\r\n\r\n    gulp.task('app-bundle', function() {\r\n        var builder = new Builder('src', 'src/systemjs.config.js');\r\n\r\n        return builder.buildStatic('app/main.js', 'build/scripts/app.min.js', { minify: true });\r\n    });\r\n\r\nBut... if i try to run a server on the build package the app doesn't work when it tried to run the lazy loaded modules.\r\nIt gives me the following error:\r\n\r\n    GET http://127.0.0.1:8080/app/modules/FIRST-SECTION/first-section.module 404 (Not Found)\r\n\r\nHere is my `systemjs.config.js` file:\r\n\r\n\t(function (global) {\r\n\t\tSystem.config({\r\n\t\t    paths: {\r\n\t\t        'npm:': './node_modules/',\r\n\t\t    },\r\n\t\t    map: {\r\n\t\t        app: 'app',\r\n\t\t        '@angular/core': 'npm:@angular/core/bundles/core.umd.js',\r\n\t\t        '@angular/common': 'npm:@angular/common/bundles/common.umd.js',\r\n\t\t        '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',\r\n\t\t        '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',\r\n\t\t        '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',\r\n\t\t        '@angular/http': 'npm:@angular/http/bundles/http.umd.js',\r\n\t\t        '@angular/router': 'npm:@angular/router/bundles/router.umd.js',\r\n\t\t        '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',\r\n\t\t        '@angular/upgrade': 'npm:@angular/upgrade/bundles/upgrade.umd.js',\r\n\t\t        'rxjs': 'npm:rxjs',\r\n\t\t        'lodash': 'npm:lodash/lodash.min.js',\r\n\t\t        'jquery': 'npm:jquery/dist/jquery.min.js',\r\n\t\t    },\r\n\t\t    packages: {\r\n\t\t        app: { main: './main.js', defaultExtension: 'js' },\r\n\t\t        rxjs: { defaultExtension: 'js' },\r\n\t\t    }\r\n\t\t});\r\n\t})(this);\r\n\r\nThank you."},"comment":{"url":"https://api.github.com/repos/systemjs/builder/issues/comments/259163763","html_url":"https://github.com/systemjs/builder/issues/729#issuecomment-259163763","issue_url":"https://api.github.com/repos/systemjs/builder/issues/729","id":259163763,"user":{"login":"smartm0use","id":5399265,"avatar_url":"https://avatars.githubusercontent.com/u/5399265?v=3","gravatar_id":"","url":"https://api.github.com/users/smartm0use","html_url":"https://github.com/smartm0use","followers_url":"https://api.github.com/users/smartm0use/followers","following_url":"https://api.github.com/users/smartm0use/following{/other_user}","gists_url":"https://api.github.com/users/smartm0use/gists{/gist_id}","starred_url":"https://api.github.com/users/smartm0use/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smartm0use/subscriptions","organizations_url":"https://api.github.com/users/smartm0use/orgs","repos_url":"https://api.github.com/users/smartm0use/repos","events_url":"https://api.github.com/users/smartm0use/events{/privacy}","received_events_url":"https://api.github.com/users/smartm0use/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T15:16:20Z","updated_at":"2016-11-08T15:16:20Z","body":"Which repo? [Yours](https://github.com/Anjmao/angular2-production-workflow) or [abidmix's](https://github.com/abidmix/SystemjsBuilderLazyLoad)?\r\n\r\nThe former doesn't use lazy loading modules; the latter doesn't create the build structure as i want."}}
{"actor":{"display_login":"smartm0use"}}