Package Exports
- tsup-preset-solid
- tsup-preset-solid/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tsup-preset-solid) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tsup-preset-solid
Preset for building your SolidJS packages with ease using tsup (powered by esbuild).
Features
Preconfigured - Just install, set your entries and use it.
Fast - Uses esbuild under the hood.
SolidStart support - Includes
solid
export condition with preserved JSX.Best practices - Ensures that the built library works well with Solid's tooling ecosystem.
Development and server entries - Creates a separate entry for development, server-side rendering and production form a single source.
Multiple entries - Supports multiple package entries. (submodules)
Automatic package.json configuration - Automatically writes export fields to
package.json
based on passed options.
Warning This is a very fresh project, so diverging from the happy path may cause unexpected results. Please report any issues you find.
Quick start
Install it:
npm i -D tsup tsup-preset-solid
# or
pnpm add -D tsup tsup-preset-solid
Add it to your tsup.config.ts
// tsup.config.ts
import { defineConfig } from 'tsup-preset-solid'
export default defineConfig(
// entries (array or single object)
[
// first entry in array should be the main one (index)
{
// entries with '.tsx' extension will have `solid` export condition generated
entry: 'src/index.tsx',
// Setting `true` will generate a development-only entry
devEntry: true,
// Setting `true` will generate a server-only entry
serverEntry: true,
},
{
entry: 'src/additional.ts',
},
],
// additional options
{
// Setting `true` will console.log the package.json fields
printInstructions: true,
// Setting `true` will write export fields to package.json
writePackageJson: true,
// Setting `true` will remove all `console.*` calls and `debugger` statements
dropConsole: true,
// Enable CJS output (default: false)
cjs: true,
},
)
Add scripts to your package.json
{
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
}
}
Usage gotchas
solid
export condition - This preset will automatically addsolid
export condition to yourpackage.json
if you have any.tsx
entry files. This is required for SolidStart to work properly."type": "module" - This preset requires your package to be a module.
Needs ESM - This preset requires your package to be ESM. If you want to support CJS additionally, you can set
cjs: true
in the options. Other export format are not supported.development-only
solid
export issue - Currently SolidStart has an issue withdevelopment
andsolid
export condition. (solid-start issue)