shlomiassaf / ngx-modialog

Modal / Dialog for Angular
http://shlomiassaf.github.io/ngx-modialog
MIT License
686 stars 242 forks source link

Improve system JS demo so config section is more readable. #83

Open loganfreeman opened 8 years ago

loganfreeman commented 8 years ago

I found I have to import like:

import {MODAL_BROWSER_PROVIDERS} from 'angular2-modal/platform-browser/index';

if I just do:

import {MODAL_BROWSER_PROVIDERS} from 'angular2-modal/platform-browser';

It would throw error like:

couldn't find node_modules/angular2-modal/platform-browser.js
shlomiassaf commented 8 years ago

This is a systemJS configuration things.

Look at the demo (index.systemjs.html), see how package is configured by setting a main file.

shlomiassaf commented 8 years ago

I'll try to make a more coherent version of config object for system JS.

Basically, in Webpack, index files are automatically resolved inside a directory. In system JS we need to specifically set them.

This is more commonly known as barrels.

See material2 config section, they set the main explicitly for every angular module including platform specific modules.

hdsler commented 8 years ago

I'm using systemJS and as @shlomiassaf said, I've added var packages = { ...other_stuff, 'angular2-modal/platform-browser': { defaultExtension: 'js', main: 'index.js' } }; and error disappeared