Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Custom system.js config not working for Plunker #1424

Closed
Foxandxss opened this issue May 18, 2016 · 5 comments
Closed

Custom system.js config not working for Plunker #1424

Foxandxss opened this issue May 18, 2016 · 5 comments

Comments

@Foxandxss
Copy link
Member

Problem:

If we need to define custom barrels in our examples, we will need to extend the systemjs.config.js (via another file or inline in the index.html).

That won't work on Plunker because we load .js locally and .ts in plunker.

Solutions:

We could either offer a different index.html for plunker (if we inline the config). That is easy to do, doesn't need changes.

We could have a systemjs.custom.js for this new custom stuff and offer a systemjs.custom.plunker.js that plunker would use. Downsides, we will need to write the same thing twice.

A third solution would be generating the systemjs.custom.plunker.js on the fly by replacing the extensions at systemjs.custom.js. It could be potentially brittle, but shouldn't give any troubles.


I have no problem in fixing this, but first I want to see your ideas or see if I am missing an obvious solution.

/cc @wardbell

@wardbell
Copy link
Contributor

Not a fan of those choices. What is wrong with inline in the index.html?

@Foxandxss
Copy link
Member Author

Local uses .js and plunker .ts.

@Foxandxss
Copy link
Member Author

Let me explain better now that I am not at phone.

If we have a app/heroes as a barrel and app/heroes/shared as another barrel, we need to add extra systemjs configuration like:

System.config({
  packages: {
    'app/heroes': {main: 'index.js', defaultExtension: 'js'},
    'app/heroes/shared': {main: 'index.js', defaultExtension: 'js'}
  }
});

That won't work on a plunker because we transpile "on the fly" so we need to do:

System.config({
  packages: {
    'app/heroes': {main: 'index.ts', defaultExtension: 'ts'},
    'app/heroes/shared': {main: 'index.ts', defaultExtension: 'ts'}
  }
});

So we need a way to have different "extra config" for local and plunker.

@wardbell
Copy link
Contributor

We can make it work on plunker very easily because we have RegEx transformers specifically for this use case. See tools/plunker-builder/indexHtmlTranslator.js

@wardbell
Copy link
Contributor

Fixed by #1439

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants