Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #9226
Closed
Open
Issue created Jun 26, 2020 by Administrator@rootContributor

Yarn 2 "portal:" local components import compilation failure because of ModuleScopePlugin

Created by: jonenst

Describe the bug

Description here: https://stackoverflow.com/questions/61530712/module-not-found-error-using-yarn-2-to-link-react-components

TLDR: When adding "MyExternalComponent": "portal:../MyExternalComponent" dependencies to package.json, and importing the component with import Mycomponent from MyExternalComponent, the build fails because of the ModuleScopePlugin restriction "You attempted to import components which falls outside of the project src/ directory"

Which terms did you search for in User Guide?

"yarn 2 ModuleScopePlugin" "portal: ModuleScopePlugin"

Environment

yarn2

(paste the output of the command here.)

Steps to reproduce

(Write your steps here:)

  1. create a package in folder Foo
  2. yarn dlx create-react-app Bar
  3. add "Foo": "portal:../Foo" to Bar's package.json 4 build Bar

Expected behavior

Should work

Actual behavior

compilation error: "You attempted to import components which falls outside of the project src/ directory"

Reproducible demo

https://bitbucket.org/cjmyles/yarn2-link/commits/e02b93771dfded0215bdba456d31aea011367807

Assignee
Assign to
Time tracking