Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Support module as a built in #39

Closed
guybedford opened this issue Jan 14, 2015 · 11 comments
Closed

Support module as a built in #39

guybedford opened this issue Jan 14, 2015 · 11 comments

Comments

@guybedford
Copy link
Member

Only in Node.

@victorwpbastos
Copy link

How can you plan to do that? Maybe I could help but I need some guidance.

@guybedford
Copy link
Member Author

Thanks, it's mostly just the same pattern as the others https://github.com/jspm/npm/blob/master/npm.js#L28.

It isn't much more than a wrapper though, so I will aim to get to it soon.

@victorwpbastos
Copy link

I can't create the repo. 😢

@guybedford
Copy link
Member Author

Ok, I've added this above.

@victorwpbastos
Copy link

How can I test this? When I try to reinstall npm:ractive-load nodelibs-module is not being intalled together.

@guybedford
Copy link
Member Author

You need to update the jspm-npm dependency of jspm to this master version, then use install -f

@victorwpbastos
Copy link

I did that. Doesn't work.

@guybedford
Copy link
Member Author

Ahh, this is because ractive contains this code:

Module = (require.nodeRequire || require)('module');

The above isn't a require that can be picked up by static analysis.

Instead I would suggest loading ractive-load as a global or AMD library using an override, something like:

jspm install npm:ractive-load@0.4.0 -o "{ format: 'global' }"

See https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm#package-module-format for more info.

@guybedford
Copy link
Member Author

Created an issue to track this above, will help as soon as I can, overrides are a pain to test out as there are quite a few factors, but perseverance pays off!

@victorwpbastos
Copy link

Thanks for the support!

@victorwpbastos
Copy link

I installed ractive-load as a global. Now when jspm bundle-sfx runs I get this:

captura de tela de 2015-01-19 23 19 13

My ract plugin:

require('ractive');
require('ractive-load');

exports.translate = function(load) {
    load.source = 'module.exports = ' + JSON.stringify(load.source);
    return Ractive.load(load.address).then(function(c) {
        Ractive.components['ract-test'] = c;
    });
}

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

No branches or pull requests

2 participants