New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@adamdickinson/react-cosmos-esbuild

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adamdickinson/react-cosmos-esbuild

Support for esbuild with React Cosmos.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

React Cosmos ESbuild

ESbuild-compatible React Cosmos.

Installation

npm install @adamdickinson/react-cosmos-esbuild

or

yarn add @adamdickinson/react-cosmos-esbuild

Usage

If it's a simple enough build process, you can totally get away with just running:

yarn cosmos-esbuild

Doing so runs cosmos, as well as esbuild with a default, cosmos-compatible config.

However, a lot of esbuild-driven projects have some rather complex requirements, so this package accommodates that too. By specifying a esbuildConfigPath in your cosmos config, you can inject your own esbuild config in to adjust the esbuild config this package uses.

Sample cosmos.config.json:

{
  "esbuildConfigPath": "./scripts/config.js"
}

Sample config.js:

module.exports = {
  define: {
    'process.env.RUNNING_COSMOS', 'true'
  }
}

This config will then be used as the baseline config for the esbuild runner that is used to power cosmos as follows:

{
  ...config,
  bundle: true,
  entryPoints: [MAIN_TS_PATH],
  outfile: MAIN_JS_PATH,
  outdir: undefined
}

In other words, any custom config values for bundle, entryPoints, outfile and outdir will be overridden in order for the package to work with cosmos.

Got some things you'd like to see?

Spin up a PR! Standards are pretty high, but feedback is a cornerstone of any good pull request so expect much love for any contributions.

FAQs

Package last updated on 18 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts