Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking bug #655

Closed
tauren opened this issue Apr 9, 2015 · 4 comments
Closed

Linking bug #655

tauren opened this issue Apr 9, 2015 · 4 comments

Comments

@tauren
Copy link

tauren commented Apr 9, 2015

I have found that if I use the word process anywhere in a commonjs module (code or comments), that JSPM will wrap the file with require('process') when doing a jspm link.

This file is in an npm package that my client application is dependent on.

'use strict';
module.exports = {
  type: 't-process'
};

After doing a jspm link in the package directory and a jspm install --link ... in the app directory, the following file exists in jspm_packages:

/* */ 
(function(process) {
  'use strict';
  module.exports = {type: 't-process'};
})(require("process"));

Note that this happens when the word is in code or comments! I am working around the problem with code like this: type: 't-pro'+'ess'.

@guybedford
Copy link
Member

@tauren could you clarify how this wrapping is causing an issue to the use of the package?

I've created an issue for jspm-npm at jspm/npm#55.

@tauren
Copy link
Author

tauren commented Apr 9, 2015

@guybedford The package that this file is in is just a standard npm module. When I am making changes to it and my client app that consumes it at the same time, I would like to link it rather than bumping versions and doing npm publish. After doing the link, the client app complains that it cannot load process.js, but it is trying to find it at the root of the server, not from within jspm_packages. I don't think the jspm install --link command is properly adding dependencies to the client app, but I'm just guessing here.

Bottom line is that this simple code should not add a dependency that is not needed. Other files in this package are not wrapped with a require('process'), only files that have the word 'process' anywhere within them. I'm sure that doing a global grep for process is not the intended behavior and wanted you to know.

@guybedford
Copy link
Member

@tauren thanks so much for clarifying. Yes these are linking problems.

The real issue here is how to add a dependency to a linked package, without reinstalling the linked package.

Node doesn't have this problem because of the fact that the linked package automatically links its node_modules folder, so this is something we need to put some thought to in terms of how jspm does its dependency management.

Perhaps running jspm install --link again is a necessary step for a new dependency unfortunately. Let me see if I can come up with a better solution though.

@guybedford
Copy link
Member

@tauren really sorry for the delay in fixing these linking bugs for you. There are some deep architecture issues here, which I've planned to resolve in the next major release, but this will take some time.

Let's focus on the workarounds for you for now, which would be jspm/npm#55.

So closing this, and prioritising the above issue. If you want to chat on Gitter sometime further about these linking issues and how we can prioritise better around them for your workflows, please do reach out to me there.

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

No branches or pull requests

3 participants