Mac OSX (El Capitan?)
ng --version. If there's nothing outputted, pleaseangular-cli: 1.0.0-beta.6
node: 5.10.1
os: darwin x64
ng build -prod
The dist/app-concat.js file is missing.
I tried to reproduce on a new beta.6 project and didn't get this issue. Can you provide me with more detailed repro steps?
Oops! I had this issue because I originally created a mobile project ng new app --mobile which output this code in index.html:
{{#if environment.production}}
<script src="/app-concat.js" async></script>
{{else}}
{{#each scripts.polyfills}}
<script src="{{.}}"></script>
{{/each}}
<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
{{/if}}
However, because I had other issues related to app-shell and universal, I turned off the mobile flag in angular-cli.json. But the build was still trying to fetch the app-concat.js.
I'm closing this issue.
Ah, that makes sense!
Why isn't there a way to bundle vendor files on a non --mobile app?
@drejohnson ng build -prod bundles vendor files on both mobile and non-mobile apps.
@filipesilva ng build -prod doesn't bundle for me. When I create a project using --mobile, all scripts get bundled into the app-concat.js file. This conditional doesn't exit in the index.html file for non mobile apps. I'm I missing something?
{{#if environment.production}}
<script src="/app-concat.js" async></script>
{{else}}
{{#each scripts.polyfills}}
<script src="{{.}}"></script>
{{/each}}
<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
{{/if}}
@drejohnson it is because of this: https://github.com/angular/angular-cli/blob/master/addon/ng2/blueprints/ng2/files/__path__/index.html#L34-L60
For the time being, you can't switch from mobile to non-mobile generated apps (or the other way around).
ng build -prod in non mobile apps will always bundle, but as @manekinekko says you can't switch from one to the other.
In a non-mobile project, run ng build -prod and check the main.js. It will include the whole app.
I'm sorry for the confusion of my question. But running ng build -prod on a mobile app bundles everything including systemjs to produce a single script tag <script src="/app-concat.js" async></script>. Whereas running the same command for non-mobile app bundles my app and associated vendors files but still has to request multiple scripts including systemjs, polyfills and zone.js instead of producing a single file like mobile does:
<script src="vendor/es6-shim/es6-shim.js"></script>
<script src="vendor/reflect-metadata/Reflect.js"></script>
<script src="vendor/systemjs/dist/system.src.js"></script>
<script src="vendor/zone.js/dist/zone.js"></script>
<script>
System.import('system-config.js').then(function () {
System.import('main');
}).catch(console.error.bind(console));
</script>
That is correct, and intended at the moment.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._