Set "@/" relative to package in monorepo
See original GitHub issueWhat 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:
- Created 4 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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?