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
Improve dev script #468
Improve dev script #468
Conversation
const path = require('path'); | ||
const rollup = require('rollup'); |
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 weren't actually being used so I 🔥 them.
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.
👍
rollup.config.dev.js
Outdated
}; | ||
|
||
const plugins = [ | ||
resolve(), |
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 removed clean
here in hopes that it would speed up builds.
rollup.config.dev.js
Outdated
} | ||
|
||
warn(warning); | ||
}; |
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 recognize this code could be put in it's module. I can do this in this PR if you all want.
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.
Overall this looks like a good improvement. Would it be possible to make use of Rollup's --environment
argument so that we don't need to use two separate Rollup config files?
const path = require('path'); | ||
const rollup = require('rollup'); |
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'm cool with |
It would make it easier to be specific about what we want in dev vs prod without sharing code and / or duplicating configuration. And, we could have more than just dev and prod scenarios (what about test?). |
const resolve = require('rollup-plugin-node-resolve'); | ||
const cleanup = require('rollup-plugin-cleanup'); | ||
|
||
const {NODE_ENV} = process.env; |
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 think using NODE_ENV
has become a standard so 🤷♂️
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've updated to use |
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.
LGTM 👍 thanks for saving us previous dev time @mikkoh !
@@ -31,7 +31,8 @@ | |||
], | |||
"scripts": { | |||
"clean": "rm -rf ./lib ./dist", | |||
"build": "tsc && rollup -c", | |||
"build": "tsc && rollup -c --environment NODE_ENV:production", | |||
"build:dev": "tsc && rollup -c --environment NODE_ENV:development", |
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.
👍
const resolve = require('rollup-plugin-node-resolve'); | ||
const cleanup = require('rollup-plugin-cleanup'); | ||
|
||
const {NODE_ENV} = process.env; |
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 @mikkoh, my dev day today speed up considerably 🙏 |
🙌 I might look into it more and see if we can make some more speedups. |
This PR does two things. Makes
dev
watch.ts
files also and attempts to improve build speed forwatch
.So I've seen #235 which is more extensive where it breaks out tests etc.
I'm putting this out there to bring this up as a discussion again.
Even after this PR
build
takes ~2sec to run which is not nice. I'm not actually sure why builds take so long. Might investigate at some point.