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 module and types settings in package.json for wouter and wouter/preact #55

Merged
merged 6 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ coverage/
preact/*
!preact/react-deps.js
!preact/index.d.ts
!preact/package.json
11 changes: 11 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = function(api) {
api.cache(true);

const presets = ["@babel/preset-env"];
const plugins = ["@babel/plugin-transform-react-jsx"];
Copy link
Contributor

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"]
}

?

Copy link
Contributor Author

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.

Copy link
Contributor

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


return {
presets,
plugins
};
};
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"*.d.ts",
"preact/"
],
"module": "index.js",
"types": "index.d.ts",
"scripts": {
"test": "jest --verbose --coverage",
"size": "size-limit",
Expand All @@ -36,14 +38,6 @@
"limit": "247 B"
}
],
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
"@babel/plugin-transform-react-jsx"
]
},
"eslintConfig": {
"extends": "eslint:recommended",
"parserOptions": {
Expand Down
13 changes: 13 additions & 0 deletions preact/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "wouter-preact",
"version": "2.1.1",
"private": true,
"description": "A minimalistic routing for Preact. Nothing extra, just HOOKS.",
"module": "index.js",
"types": "index.d.ts",
"license": "ISC",
"peerDependencies": {
"wouter": "^2.1.1",
"preact": "^10.0.0-rc.0"
}
}