mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-24 03:32:58 +03:00
build: Add build for browsers
This commit is contained in:
parent
3f7136734b
commit
701e82300b
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@ dist
|
||||
out
|
||||
*.d.ts
|
||||
*.tgz
|
||||
umd
|
@ -35,6 +35,7 @@
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"browser": "./umd/browser.global.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
|
8
src/browser.ts
Normal file
8
src/browser.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import * as toolkit from './index';
|
||||
|
||||
interface Window {
|
||||
_: typeof toolkit;
|
||||
}
|
||||
|
||||
declare var window: Window;
|
||||
window._ = toolkit;
|
@ -1,9 +1,20 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
export default defineConfig({
|
||||
format: ['cjs', 'esm'],
|
||||
entry: ['src/*.ts', 'src/*/*.ts', '!**/*.{spec,test,test-d}.*'],
|
||||
sourcemap: true,
|
||||
dts: true,
|
||||
clean: true,
|
||||
});
|
||||
export default [
|
||||
defineConfig({
|
||||
format: ['cjs', 'esm'],
|
||||
entry: ['src/*.ts', 'src/*/*.ts', '!**/*.{spec,test,test-d}.*'],
|
||||
sourcemap: true,
|
||||
dts: true,
|
||||
clean: true,
|
||||
}),
|
||||
defineConfig({
|
||||
format: ['iife'],
|
||||
outDir: 'umd',
|
||||
entry: ['src/browser.ts'],
|
||||
sourcemap: true,
|
||||
dts: false,
|
||||
clean: true,
|
||||
minify: true,
|
||||
}),
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user