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

Add @babel/core dependencies to react/preact integrations #3928

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/red-wasps-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@astrojs/preact': patch
'@astrojs/react': patch
---

Removes @babel/core peerDependency warning
1 change: 1 addition & 0 deletions packages/integrations/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dev": "astro-scripts dev \"src/**/*.ts\""
},
"dependencies": {
"@babel/core": ">=7.0.0-0 <8.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@babel/core is only used inside of astro, so I think adding this to a peerDependencies" instead of dependencies` would also silence the error but not result in adding this as an explicit dependency (since pnpm/yarn support bubbling up peer dependencies this way).

Worth confirming, but I think that's the better move here if it works!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, small hiccup with this approach, astro add automatically installs any peerDependencies from these packages into your Astro project. :(

Not sure the best way to handle this...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it and didn't work unfortunately. I think by making it a peerDependency you are making the user install it.

└─┬ @astrojs/react
  ├── ✕ missing peer @babel/core@">=7.0.0-0 <8.0.0"
  └─┬ @babel/plugin-transform-react-jsx
    ├── ✕ missing peer @babel/core@^7.0.0-0
    └─┬ @babel/plugin-syntax-jsx
      └── ✕ missing peer @babel/core@^7.0.0-0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, that's surprising since Astro has it as a dependency. I actually thought that having it as a dep in astro solved this, so maybe it's new behavior from pnpm?

I guess I'm not against leaving it in deps then!

"@babel/plugin-transform-react-jsx": "^7.17.12",
"babel-plugin-module-resolver": "^4.1.0",
"preact-render-to-string": "^5.2.0"
Expand Down
1 change: 1 addition & 0 deletions packages/integrations/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dev": "astro-scripts dev \"src/**/*.ts\""
},
"dependencies": {
"@babel/core": ">=7.0.0-0 <8.0.0",
"@babel/plugin-transform-react-jsx": "^7.17.12"
},
"devDependencies": {
Expand Down
24 changes: 6 additions & 18 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.