Brew Images - React
Generates responsive image URLs for various screen sizes and automatically lazy-loads them!
Commands
The recommended workflow is to run TSDX in one terminal:
yarn start
This builds to /dist
and runs the project in watch mode so any edits you save inside src
causes a rebuild to /dist
.
To do a one-off build, use yarn build
.
To run tests, use yarn test
.
To publish to NPM, run yarn publish
.
Jest
Jest tests are set up to run with yarn test
. This runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.
Rollup
TSDX uses Rollup v1.x as a bundler and generates multiple rollup configs for various module formats and build settings. See Optimizations for details.
TypeScript
tsconfig.json
is set up to interpret dom
and esnext
types, as well as react
for jsx
.
Optimizations
Please see the main tsdx
optimizations docs. In particular, know that you can take advantage of development-only optimizations:
// ./types/index.d.ts
declare var __DEV__: boolean;
// inside your code...
if (__DEV__) {
console.log('foo');
}
Testing Locally
Use yarn link
to enable testing this package locally within another node project.
Each time you make a change, you'll need to run yarn build
for those changes to be propogated to the test environment.