systemjs-config-builder icon indicating copy to clipboard operation
systemjs-config-builder copied to clipboard

Doesn't seem to work?

Open unional opened this issue 8 years ago • 12 comments

I follow the example to do:

// in an empty folder.
yarn global add systemjs-tools
yarn add systemjs systemjs-nodelibs systemjs-plugin-babel react react-dom
systemjs config

But the systemjs config just exit and no generated.config.js is created.

unional avatar Feb 08 '17 03:02 unional

I'm using yarn: 0.19.1, npm: 4.0.5, node: 7.5.0

unional avatar Feb 08 '17 03:02 unional

I think the command has changed to generate-config. Run systemjs --help to verify.

alexisvincent avatar Feb 08 '17 05:02 alexisvincent

Thanks. It now complains:

:: exiting :: couldn't find a valid systemjs-tools config

unional avatar Feb 08 '17 05:02 unional

Damn. I recently changed how systemjs initializes itself. Just heading in to a meeting now. Can fix after that.

alexisvincent avatar Feb 08 '17 06:02 alexisvincent

No problem. Take your time. 🌷 Thanks for the good work.

unional avatar Feb 08 '17 06:02 unional

@unional Just had a look, I actually use the config for systemjs-tools, so to fix this, in your package.json, add:

{
    ...
    "systemjs-tools": {}
    ...
}

This will indicate to config builder where the root is. You can also customize the cache file location via

{
    ...
    "systemjs-tools": {
        "cache": ".myCustomeCacheFile.json"
    }
    ...
}

alexisvincent avatar Feb 08 '17 11:02 alexisvincent

@unional did this solve your issue?

alexisvincent avatar Feb 10 '17 19:02 alexisvincent

I see. Have not try it yet. Is it possible to make it not rely on this? IMO it sounds like an optional configuration. Are you doing a lookup in folder structure to find the root package.json?

unional avatar Feb 10 '17 19:02 unional

Yes, and then it uses the file it finds to act as a 'root'. But can probably offer a default. Although this isn't high priority for me right now

alexisvincent avatar Feb 11 '17 08:02 alexisvincent

Could you add some documentation on how the cache works? Every time I run generate-config, it takes a long time to complete, and don't see any cache files created.

simondiep avatar Nov 14 '17 16:11 simondiep

I don't have time to write docs right now, since I'm right in the middle of exams, but you can take a look here https://github.com/alexisvincent/systemjs-tools/blob/master/lib/cli.js#L21

It gets the cache out of the systemjs cache. You should see a .systemjs.cache.json file, which you configure by the cache key in the config. Checkout https://github.com/alexisvincent/systemjs-tools/blob/master/docs/config.md.

alexisvincent avatar Nov 14 '17 17:11 alexisvincent

There might be a bug with the cache generation, as I see a systemjs.cache file created but with contents of undefined.

https://github.com/alexisvincent/systemjs-config-builder/blob/master/lib/index.js#L425

simondiep avatar Nov 14 '17 18:11 simondiep