This commit is contained in:
55
packages/web/tsup.config.ts
Normal file
55
packages/web/tsup.config.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
const { version } = require('./package.json');
|
||||
|
||||
export default defineConfig([
|
||||
// Modern ESM and CJS bundles
|
||||
{
|
||||
entry: ['src/index.ts'],
|
||||
format: ['esm', 'cjs'],
|
||||
dts: true,
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
clean: true,
|
||||
env: {
|
||||
PKG_VERSION: version,
|
||||
},
|
||||
},
|
||||
// IIFE bundle (for browser scripts)
|
||||
{
|
||||
entry: {
|
||||
'aptabase.debug': 'src/index.ts',
|
||||
},
|
||||
format: ['iife'],
|
||||
globalName: 'aptabase',
|
||||
outExtension() {
|
||||
return { js: `.js` }
|
||||
},
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
clean: false, // has been cleaned in previous step
|
||||
define: {
|
||||
'process.env.PKG_VERSION': JSON.stringify(version),
|
||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
||||
},
|
||||
},
|
||||
// Minified IIFE bundle
|
||||
{
|
||||
entry: {
|
||||
'aptabase.min': 'src/index.ts',
|
||||
},
|
||||
format: ['iife'],
|
||||
globalName: 'aptabase',
|
||||
minify: true,
|
||||
outExtension() {
|
||||
return { js: `.js` }
|
||||
},
|
||||
splitting: false,
|
||||
sourcemap: true,
|
||||
clean: false, // has been cleaned in previous step
|
||||
define: {
|
||||
'process.env.PKG_VERSION': JSON.stringify(version),
|
||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
||||
},
|
||||
}
|
||||
])
|
||||
Reference in New Issue
Block a user