-
Notifications
You must be signed in to change notification settings - Fork 181
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
feat: 👷 Use vite instead of rollup #514
Conversation
"fast-deep-equal": "^3.1.3" | ||
}, | ||
"devDependencies": { | ||
"@latticexyz/recs": "^1.41.0", | ||
"@latticexyz/schema-type": "^1.41.0", | ||
"@latticexyz/utils": "^1.41.0", |
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.
I added some peer deps of @lattice/recs that were missing
packages/react/vite.config.ts
Outdated
environment: "jsdom", | ||
globals: true, | ||
}, | ||
plugins: [nodeResolve() as any, typescript(), commonjs(), peerDepsExternal(), pluginJson()], |
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.
These are the same rollup plugins being used before. We likely don't need all of them anymore vite likely handles some of this but included same plugins so this change is less likely to break anything
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.
any way we can test for which ones we actually need and remove the rest? would be nice to slim this down as I don't know when we'll come back to this
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.
Yes would be easy just need to remove them 1 at a time and see if they break or don't break. I'm guessing we don't need nodeResolve. I'm guessing we don't need commonjs(). I'm guessing we don't need pluginJson
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.
I was right removed everything except typescript and peerDepsExternal
test: { | ||
environment: "jsdom", | ||
globals: 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.
this config is the test config too which is very nice
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.
Note how I didn't need to change any of the tests. This is because jest and vitest are almost the same api
lib: { | ||
name: "@latticexyz/react", | ||
entry: "src/index.ts", | ||
formats: ["cjs", "es"], |
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.
Before we defaulted to only building cjs
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", |
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.
The way this repo in general handles setting all this up is a bit of a mess. This is what build tools use to find the types, esm, or cjs. I would clean this up everywhere.
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.
Currently we're pointing main
to the typescript source in order to have instant updates during development, and then only set it to dist/index.js
in the prerelease
step. Down to change this if find an equally performant alternative to pointing to the ts source for development though
packages/react/.eslintrc
Outdated
"plugins": ["react", "react-hooks"] | ||
"plugins": ["react", "react-hooks"], | ||
"rules": { | ||
"@typescript-eslint/consistent-type-imports": "error" |
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 is a good rule to always have turned on and it has an autofixer
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.
can we separate this into its own PR and turn this on everywhere? or is this needed here for better builds?
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.
Yea it should be seperate pr. This pr in general mostly exists just to try to solicit early feedback before I go about refactoring anything. I was going to open an issue but this pr was quick to whip up and I figured it would be better than an issue
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.
removed from this pr I can open a seperate pr later this week to add it. I'll see if there are any other lint rules useful to add too while I'm at it. I will only add a lint rule if it has an autofixer and is useful
ooc why did you resolve your own comments? makes it a little hard to have a conversation in them now that they're all collapsed |
@holic reopening any that conversations are happening in. Since I tend to leave tons of comments on all my prs that are mostly there to just provide extra context my general habit is to comment and then resolve it so the comment is there but the comment is also not getting in the way creating extra noise in the review |
the context is helpful for us reviewing too, so I have a slight preference to leave em open! |
remove rollup and jest config Remove acccidental dep revert eslint change for a seperate pr remove unused plugins remove rollup plugins from correct package.json
cd10673
to
980d8ec
Compare
preset: "ts-jest", | ||
moduleNameMapper: { | ||
// fix TS build issues | ||
"^(..?/.*).js$": "$1", |
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.
Here can see jest wasn't working as intended
moved this to a draft until we can rebase/merge main now that pnpm has landed |
we're moving to tsup, see #660 |
Rather than opening an issue I figured I'd make a pr and see what everyone thought about this.
Problems
Solution
Build outputs
main
in package.json and esm output asmodule
. This will make it work seemlessly no matter what build tool user is using