Evan
Evan

Reputation: 167

Angular 2 Cli generated project

Using a Angular 2 Cli generated project, is there a way to bundle the angular 2 node_modules and leave the app code un-bundled ? I have to deploy test code to a limited device and sending a bundle every time is time consuming.

Upvotes: 1

Views: 76

Answers (2)

Evan
Evan

Reputation: 167

It appears what I'm looking for is not officially supported https://medium.com/@jeff.boothe/angular-cli-meets-webpack-7c9b1a1e1e89#.b7o70ausk

Looks like someone might have created a work around here that I'm going to try to play with. https://github.com/angular/angular-cli/issues/1656#issuecomment-240171375

Upvotes: 1

Logan H
Logan H

Reputation: 3423

My best guess, but I think it would have something to do in the system-config.ts. Maybe commenting out the barrels that refer to your projects folders/components.

Again I don't really know but I think that is where it bundles your apps files and we are telling it not to do your apps files. Now I don't know if that means it won't even be included in the build or not, which is I think what you are going for.

Now it may look sketch commenting something out that is "Managed by the CLI" but you can always go back and uncomment

src/system-config.ts

////////////////////////////////////////////////////////////////////////////////////////////////
/***********************************************************************************************
 * Everything underneath this line is managed by the CLI.
 **********************************************************************************************/
const barrels: string[] = [
  // Angular specific barrels.
  '@angular/core',
  '@angular/common',
  '@angular/compiler',
  '@angular/forms',
  '@angular/http',
  '@angular/router',
  '@angular/platform-browser',
  '@angular/platform-browser-dynamic',

  // Thirdparty barrels.
  'rxjs',

  // App specific barrels.
  // 'app',
  // 'app/shared',
  // 'app/my-table',
  // 'app/nav-bar',
  // 'app/my-system-setup-form',
  /** @cli-barrel */
];

UPDATE

You must be running Angular Cli beta.10+ where they made the switch to web pack as seen HERE.

There must be some config file that sets up the bundle/build of your Angular 2 app.

Upvotes: 0

Related Questions