Skip to content

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

Closed

Description

@slavaspirit

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)'
    ]
  });
};

Activity

  1. filipesilva commented on Aug 28, 2016

    @filipesilva
    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.

  2. textbook commented on Aug 30, 2016

    @textbook

    @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
    
  3. filipesilva commented on Sep 21, 2016

    @filipesilva
    Contributor

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

  4. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  5. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions