question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set "@/" relative to package in monorepo

See original GitHub issue

What problem does this feature solve?

Right now, if you have a monorepo, the “@/” shortcut is always relative to the package that currently runs the command, i.e. vue-cli-service serve. This prevents all other packages from using “@/”.

For example, assuming the following project structure @/module1 inside some_other_package’s main.js would resolve to main_package/src/ instead of some_other_package/src/.

- root
  - packages
    - main_package
      - src/
      - package.json
    - some_other_package
      - src/
        - main.js
        - module1.js
      - package.json

What does the proposed API look like?

The vue-cli could check for the existance of package.json, and if found use that directory for the root for the alias.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
LinusBorgcommented, Apr 2, 2019

This error is pretty surely unrelated to webpack aliases, yes, at most is tangenially related only.

Did you link package A into package B with link?

Either way this seems to drift off into a support question, so feel free to ping me about it on forum.vuejs.org

This issue can be closed i think.

1reaction
LinusBorgcommented, Apr 2, 2019

As a step back: Why is this behaviour a problem in a monorepo? Typically, you wouldn’t import raw source from other packages, instead you would link packages with npm link and consume built versions, where alias paths have already been preprocessed by webpack, no?

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Monorepos for Front-end Code - Toptal
A monorepo or monorepository is a code management and architectural concept whereby you keep all your isolated bits of code inside one super...
Read more >
Import methods without using relative path syntax
I have a repository named dnd which is using Yarn workspaces with Lerna. The repository contains two main directories. packages/core packages/ ...
Read more >
Typescript: Working with Paths, Packages and Yarn Workspaces
We'll cover how to set up a Typescript-based monorepo, and introduce a ... They vastly decrease the use of relative import statements and...
Read more >
Custom import paths in a monorepo
If a module in packages/a imports another module from packages/a then a relative path would be used to import it (../path/to/module). If a ......
Read more >
Working with monorepos - Expo Documentation
Yarn workspaces require the root package.json to be private. If you don't set this, yarn install will error with a message mentioning this....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found