Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
tsup-preset-solid
Advanced tools
Preset for building your SolidJS packages with ease using tsup (powered by esbuild).
Preconfigured - Just install, set your entries and you're done.
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 preset is tailored towards a specific usage, mainly for primitives libraries or small headless libraries, so diverging from the happy path may cause unexpected results. Please report any issues you find.
npm i -D tsup tsup-preset-solid
# or
pnpm add -D tsup tsup-preset-solid
tsup.config.ts
// tsup.config.ts
import { defineConfig } from 'tsup'
import * as preset from 'tsup-preset-solid'
const preset_options: preset.PresetOptions = {
// array or single object
entries: [
// default entry (index)
{
// entries with '.tsx' extension will have `solid` export condition generated
entry: 'src/index.tsx',
// set `true` or pass a specific path to generate a development-only entry
dev_entry: 'src/dev.tsx',
// set `true` or pass a specific path to generate a server-only entry
server_entry: true,
},
{
// non-default entries with "index" filename should have a name specified
name: 'additional',
entry: 'src/additional/index.ts',
dev_entry: true,
},
{
entry: 'src/shared.ts',
},
],
// Setting `true` will remove all `console.*` calls and `debugger` statements
drop_console: true,
// Setting `true` will generate a CommonJS build alongside ESM (default: `false`)
cjs: true,
}
export default defineConfig(config => {
const watching = !!config.watch
const parsed_options = preset.parsePresetOptions(preset_options, watching)
if (!watching) {
const package_fields = preset.generatePackageExports(parsed_options)
console.log(`package.json: \n\n${JSON.stringify(package_fields, null, 2)}\n\n`)
/*
will update ./package.json with the correct export fields
*/
preset.writePackageJson(package_fields)
}
return preset.generateTsupOptions(parsed_options)
})
package.json
{
"scripts": {
"build": "tsup",
"dev": "tsup --watch"
}
}
solid
export condition
This preset will automatically add solid
export condition to your package.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 with development
and solid
export condition. (solid-start issue)
This can be "fixed" by overriding the @rollup/plugin-node-resolve
dependency in your package.json
:
{
"pnpm": {
"overrides": {
"@rollup/plugin-node-resolve": "13.3.0"
}
}
}
FAQs
Preset for building your SolidJS package with tsup.
The npm package tsup-preset-solid receives a total of 1,282 weekly downloads. As such, tsup-preset-solid popularity was classified as popular.
We found that tsup-preset-solid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.