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

Vuejs relative path starting with @/ considered as packages #869

Closed
idealley opened this issue Mar 21, 2018 · 8 comments
Closed

Vuejs relative path starting with @/ considered as packages #869

idealley opened this issue Mar 21, 2018 · 8 comments

Comments

@idealley
Copy link

Expected Behavior

Imports other vue components or any other relative files when running bit add ... when the imports are structured as follow:

  import SimpleHeader from '@/components/base/SimpleHeader'
  import Login from '@/components/authentication/Login'
  import UserProfile from '@/components/authentication/UserProfile'
  import { HTTP, sureThing } from '@/helpers/http'

@/ stands for src or root kind of like in unix cd ~ it just replaces ../../../helpers and if you move files around the imports are not broken

Actual Behavior

bit wants to resolve @/components as a node package and not as a relative path.

     > authentication/auth-app ...  missing dependencies
       missing packages dependencies (use your package manager to make sure all package dependencies are installed):
          src/components/authentication/AuthApp.vue -> @/components, @/components, @/components

Steps to Reproduce the Problem

  1. clone https://github.com/EuropeanRespiratorySociety/search
  2. (probably npm install) bit init and add components
  3. bit status you should see the above message

Specifications

  • Bit version: 0.12.10
  • Node version: 8.4.0
  • npm / yarn version: npm 5.7.1
  • Platform: OsX
  • Bit compiler (include version): none
  • Bit tester (include version): none
@GiladShoham
Copy link
Member

@idealley Thanks for reporting this.

We are still in the process of finding a solution for absolute paths in require statements.
In general, there is 2 concern regarding this:

  1. Identify the dependencies for the component
  2. Make sure the component works for someone else import the component (since he might not have the same configuration as the author), so we need to resolve the require on his environment somehow.

We are trying to find a good solution which will know to handle all the cases like the described here and in the following issues:
#865
#852

@idealley
Copy link
Author

I see! Thank you. I really look forward to it as this is for me the only blocking things to go ahead with Bit.

@idealley
Copy link
Author

Did you find any solution?

@davidfirst
Copy link
Member

Yes! We're going to provide an option to configure the alias ("@" in this case) in the bit.json file, and we'll use that configuration to correctly detect the dependencies.
You can follow the PR #980 to get updates.
I believe it'll be merged this week.

@idealley
Copy link
Author

Yeah!!! thank you.

@davidfirst
Copy link
Member

Just to keep this post up to date, the feature is merged into master, and some e2e tests were added to make sure Vue files are supported.
It'll be part of the next release, very soon.

@itaymendel
Copy link
Contributor

hi @idealley , a new version of Bit is finally available, and supports configuring a custom module resolution.

more about it here

@idealley
Copy link
Author

Thank you guys. Impressive work. I will try that in details.

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

No branches or pull requests

4 participants