-
-
Notifications
You must be signed in to change notification settings - Fork 146
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 module and types settings in package.json for wouter and wouter/preact #55
Conversation
The build failure happens because of the |
@cedeber To solve that issue move Babel config from Also latest |
Codecov Report
@@ Coverage Diff @@
## master #55 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 5 5
Lines 102 102
Branches 26 26
=====================================
Hits 102 102 Continue to review full report at Codecov.
|
@Ty3uK Thanks for the help. Looks good now. |
babel.config.js
Outdated
@@ -0,0 +1,11 @@ | |||
module.exports = function(api) { | |||
api.cache(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed indentation?
babel.config.js
Outdated
api.cache(true); | ||
|
||
const presets = ["@babel/preset-env"]; | ||
const plugins = ["@babel/plugin-transform-react-jsx"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just write
module.exports = {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-transform-react-jsx"]
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks new for Babel 7. Apparently setting the cache to true keeps the config in memory for each calls instead of reading it each time. See https://babeljs.io/docs/en/config-files#apicache. Both work. I don't care which one is preferred ;) I simply did it the way it is documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I mean
return {
presets: ["@babel/preset-env"],
plugins: ["@babel/plugin-transform-react-jsx"]
}
without unnecessary variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! This all looks good, I am going to merge it and release a new version this week.
These settings are useful for tools like pikapkg which require the module settings in order to build wouter. Adding a private
package.json
into the/preact
folder allow to doimport [..] from "wouter/preact";
I don't add the
main
setting because most bundlers are waiting for ES5 here, which wouter doesn't provide. And that's ok ;)