Skip to content

Production build doesn't hook up JS and JS.MAP files #1832

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

Closed
slavaspirit opened this issue Aug 25, 2016 · 4 comments
Closed

Production build doesn't hook up JS and JS.MAP files #1832

slavaspirit opened this issue Aug 25, 2016 · 4 comments

Comments

@slavaspirit
Copy link

Tried to build prod version with ng build --prod but faced with an issue - it hooked up css and css.map files, that wrote in my angular-cli-build.js, but ignored .js and .js.map files at all exept defaults, such as zone.js, etc.
When I execute ng build - all works fine. It hooked up all files, include js and js.map.

My angular-cli-build.js:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/**/*.+(js|js.map)',
      'es6-shim/es6-shim.js',
      'reflect-metadata/**/*.+(ts|js|js.map)',
      'rxjs/**/*.+(js|js.map)',
      '@angular/**/*.+(js|js.map)',
      'intl/**/*.+(js|js.map)',
      'list.js/dist/list.min.js',
      'moment/moment.js',
      'pikaday/pikaday.js',
      'pikaday/css/*.+(css)',
      'material-design-lite/*.+(css|js|js.map|css.map)'
    ]
  });
};
@filipesilva
Copy link
Contributor

Prod mode bundles according to your SystemJS config. If there are missing files there, it's probably because there's not listed in that config as a global library.

The difficulty in correctly configuring everything for bundling was part of the reason that lead us to move to webpack (#1455). You can upgrade using these instructions: https://github.com/angular/angular-cli#webpack-preview-release-update

Bear in mind though, that the latest webpack release doesn't yet allow you to import global libraries but will soon.

@textbook
Copy link

textbook commented Aug 30, 2016

@filipesilva until it does allow you to import global libraries, what's the fix for this? We are seeing JS files being left out of dist despite including them in angular-cli-build.js:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      ...,
      'primeng/**/*.+(js|js.map)',
      'primeui/**/*.+(min.js|css|png)'
    ]
  });
};

and system-config.js (both map and packages):

/***********************************************************************************************
 * User Configuration.
 **********************************************************************************************/
/** Map relative paths to URLs. */
const map: any = {
  'primeng': 'vendor/primeng',
  'primeui': 'vendor/primeui'
};

/** User packages configuration. */
const packages: any = {
  'primeng': { defaultExtension: 'js' },
  'primeui': { defaultExtension: 'js' }
};

using:

angular-cli: 1.0.0-beta.10
node: 6.3.1
os: darwin x64

@filipesilva
Copy link
Contributor

We've now released webpack to latest, including this functionality. See https://github.com/angular/angular-cli#webpack-update to update.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants