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
  • #3689
Closed
Open
Issue created Jan 04, 2018 by Administrator@rootContributor

Importing components from another package

Created by: iamandrewluca

Hello folks! I'm trying to make kind of living style guide and common components. That will be used in more projects. I am using create-react-app and storybook. Development works well. Then I npm install git+ssh://git@... repo into my actual project. Problem appears when I try to import a component from that style guide. I get

/home/andrewluca/Projects/style-patterns/src/components/Footer.js
Module parse failed: Unexpected token (4:2)
You may need an appropriate loader to handle this file type.
| 
| const Footer = () => (
|   <footer className="footer">
|     <div className="container">
|       <div>

If i'm importing a simple function from my package, that does not use react, it works.
I added react and react-dom as peer and dev dependencies so I can do development and use version of react from my project. My components are not compiled to any cjs es umd

⇒  nodejs -v
v8.9.4
⇒  npm -v
5.6.0

style-patterns/package.json deps

"dependencies": {
  "prop-types": "^15.6.0"
},
"peerDependencies": {
  "bootstrap": "4.0.0-beta.3",
  "react": "^16.2.0",
  "react-dom": "^16.2.0"
},
"devDependencies": {
  "@storybook/react": "^3.3.3",
  "babel-core": "^6.26.0",
  "bootstrap": "4.0.0-beta.3",
  "react": "^16.2.0",
  "react-dom": "^16.2.0",
  "reactstrap": "^5.0.0-alpha.4"
}

my-project/package.json deps

"dependencies": {
  "style-patterns": "git+ssh://git@...",
  "react": "^16.2.0",
  "react-dom": "^16.2.0",
  "react-scripts": "1.0.17"
},

Does anyone meet this problem?

Assignee
Assign to
Time tracking