Reputation: 17196
I just set up a trivial TypeScript project with React & Webpack and the edit-build-reload-test cycle isn't ideal since I have to
npm run build:dev
tsc && webpack app.js -o app.bundle.js --mode=development
Fellow coders, what techniques do you use to get a faster workflow? (non-webpack solutions welcome!)
Upvotes: 1
Views: 1445
Reputation: 17196
I just found out about Parcel. It is by far the easiest way to get a fast workflow...
Just add a <script src="app.tsx"></script>
reference to your html file and then run parcel index.html
(or whatever). Parcel
--save-dev
) if that's the language you're usingdist
folderUpvotes: 0
Reputation: 308
You can use ts-loader (or awesome-typescript-loader) to allow webpack process your typescript files.
Also, webpack can be run with --watch
option, which allows webpack to watch for files changes and rebuild bundle automatically
webpack can watch files and recompile whenever they change.
In this case your build:dev script would be webpack app.js -o app.bundle.js --mode=development --watch
(without running tsc)
PS. you can also faster the refreshing phase by enabling Hot Module Replacement so you don't need to reload the page manually (it can even preserve the state), but it would require some changes in the codebase (for react, react-hot-loader is recommended), though it would additionally require to use babel-loader
in your webpack config.
Upvotes: 1