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

Npm package Aliases doesnt work on custom plugins #3178

Closed
josx opened this issue Oct 26, 2017 · 4 comments
Closed

Npm package Aliases doesnt work on custom plugins #3178

josx opened this issue Oct 26, 2017 · 4 comments
Labels
enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug

Comments

@josx
Copy link
Contributor

josx commented Oct 26, 2017

Expected behavior

Same way to include reaction imports on my custom plugin,.
I think if this cant be fixed at least we need clear documentation on how to do it or an advice.

Actual behavior

Aliases on reaction package.json doesnt propagate to my custom plugin, if i am using package,json in my custom plugin.

So I need to replace import { registerComponent } from "@reactioncommerce/reaction-components"; with import { registerComponent } from "/imports/plugins/core/components/lib";

Steps to reproduce the behavior

Create a new plugin with npm dependencies
And the make an import and @reactioncommerce aliases doesnt work.

Versions

Node: 4.2.4
NPM: 4.1.1
Meteor Node: 4.8.4
Meteor NPM: 4.6.1
Reaction CLI: 0.19.0
Reaction: 1.5.3
Reaction branch: geo
Docker: 17.03.0-ce
@janus-reith
Copy link
Collaborator

Instead of doing the the direct imports, an easier short term solution is to copy the related aliases part of the main package.json to your custom plugin's file.

@jshimko
Copy link
Contributor

jshimko commented Oct 29, 2017

I was thinking that this could possibly be fixed by syncing the aliases automatically with reaction-cli when the app starts. The only potential issue is those changes would then need to be committed to the user's repo and it feels a little weird to make the assumption that that's ok to do on their behalf without asking every time the plugin's package.json gets updated. Might still be worth doing though. It's certainly much nicer than having to manage that manually yourself.

@josx
Copy link
Contributor Author

josx commented Oct 30, 2017

I dont know how is done the build in reaction, but it is an alias in the js processor (like aliases in webpack).

@brent-hoover brent-hoover added the enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug label Nov 15, 2017
@aldeed
Copy link
Contributor

aldeed commented Nov 27, 2019

The solution is to move things that custom plugins need to actual NPM packages. Separate issues should be filed for anything specific that anyone comes across while creating custom plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For issues that describe a feature that needs to be added, changed, or removed, but is not a bug
Projects
None yet
Development

No branches or pull requests

6 participants