JayChase / angular2-highlight-js

highlight.js integration with Angular

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular-cli not found file system.config.js

hafquangbaox opened this issue · comments

I use lastest version of angular-cli. And i can't find system.config.js. Please explain how i config it?

Have you followed the beginners guide at Angular2's home page: https://angular.io/docs/ts/latest/quickstart.html? They instruct you how to create your system.config.js file. And then you modify it with the instructions found on this repository.
The file is located at the root of your project.

From the link provided plus the modifications stated in this repository:

/**
 * System configuration for Angular samples
 * Adjust as necessary for your application needs.
 */
(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'app',
      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      // other libraries
      'rxjs':                      'npm:rxjs',
      'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
      'angular2-highlight-js': 'npm:angular2-highlight-js/lib',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'angular-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      'angular2-highlight-js': {
           main: 'highlight-js.module', defaultExtension: 'js'
      }
    }
  });
})(this);

The lastest angular-cli no have system.config.js. But i did it with a different way. tks

Hi. Sorry I haven't been around for a while. I was able to use the module with angular-cli by adding it to angular-cli.json and using the relative path for the import statement in app.module.ts instead of the SystemJS alias. I've updated the readme with the details.

it package very good, but after install it, my component will lag and slowly when type text to a input in component, and i remove it :(

I guess that might be to do with your other issue with ngFor? I will have a look to see if I can find any way of improving the performance.

i use observable, ngFor(but it just have one element in observable), and use pipe to bind trust html(my content include all code highlight in observable or normal text, if i have multi statement(>2) code tag, it will slowly and lag). I use service to show highlight auto.

Waiting for you fix it :)

Maybe this is related to #4?