antonybudianto / angular-starter

:star: Gulp Angular Starter using TypeScript (Updated to 4.4.3)
https://antonybudianto.github.io/angular-starter/
MIT License
521 stars 147 forks source link

materialize (question) #183

Closed kelvinsinsua closed 7 years ago

kelvinsinsua commented 7 years ago

Hi, i installed the project to begin the development with angular2. i wish create a project started with this "template" but i have a problem in systemjs.config.js, i need install agular2-materialize and materialize-css but in systemjs.config.js i have a error when i run npm start or npm run build.

my systemjs.config.js

`/*

(function(global) { // ENV global.ENV = global.ENV || 'development';

// map tells the System loader where to look for things
var map = {
    'app': 'src/tmp/app',
    'test': 'src/tmp/test',
    "materialize-css": "node-modules/materialize-css",
    "materialize": "node_modules/angular2-materialize",
    "angular2-materialize": "node_modules/angular2-materialize"
};

// packages tells the System loader how to load when no filename and/or no extension
var packages = {
    'app': {
        defaultExtension: 'js'
    },
    'test': {
        defaultExtension: 'js'
    },
    'rxjs': {
        defaultExtension: 'js'
    }
};

// List npm packages here
var npmPackages = [
    '@angular',
    'rxjs',
    'lodash',
    'materialize-css',
    'angular2-materialize'
];

// Add package entries for packages that expose barrels using index.js
var packageNames = [
    // App barrels
    'app/shared',

    // 3rd party barrels
    'lodash'
];

// Add package entries for angular packages
var ngPackageNames = [
    'common',
    'compiler',
    'core',
    'forms',
    'http',
    'platform-browser',
    'platform-browser-dynamic',
    'router'
];

npmPackages.forEach(function (pkgName) {
    map[pkgName] = 'node_modules/' + pkgName;
});

packageNames.forEach(function(pkgName) {
    packages[pkgName] = { main: 'index.js', defaultExtension: 'js' };
});

ngPackageNames.forEach(function(pkgName) {
    map['@angular/' + pkgName] = 'node_modules/@angular/' + pkgName +
        '/bundles/' + pkgName + '.umd.js';
    map['@angular/' + pkgName+'/testing'] = 'node_modules/@angular/' + pkgName +
    '/bundles/' + pkgName + '-testing.umd.js';
});

var config = {
    map: map,
    packages: packages
};

// filterSystemConfig - index.html's chance to modify config before we register it.
if (global.filterSystemConfig) { global.filterSystemConfig(config); }

System.config(config);

})(this); `

please if you know the correct config help me.

kelvinsinsua commented 7 years ago

`import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import 'materialize-css'; //the error start here import 'angular2-materialize';

import { AppModule } from './app.module';

declare var ENV: string;

if (ENV === 'production') { enableProdMode(); }

platformBrowserDynamic().bootstrapModule(AppModule);`

antonybudianto commented 7 years ago

Please read

https://github.com/antonybudianto/angular2-starter/wiki/FAQ#adding-css-packages