build: speed up build

This commit is contained in:
Jacob Nguyen
2023-05-10 21:35:54 -05:00
parent 7ff8917a26
commit e6f3a55d73
4 changed files with 16 additions and 13 deletions

View File

@@ -10,7 +10,7 @@
".": {
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.cjs",
"types": "dist/index.d.ts"
"types": "./dist/index.d.ts"
}
},
"scripts": {
@@ -18,8 +18,8 @@
"clean-modules": "rimraf node_modules/ && npm install",
"lint": "eslint src/**/*.ts",
"format": "eslint src/**/*.ts --fix",
"build:dev": "tsup && tsup --dts-only --outDir dist",
"build:prod": "tsup --minify && tsup --dts-only --outDir dist",
"build:dev": "tsup --metafile",
"build:prod": "tsup --minify",
"publish": "npm run build:prod",
"pretty": "prettier --write ."
},

View File

@@ -12,9 +12,8 @@
"preserveSymlinks": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"types": ["@types/node"],
"isolatedModules": true
},
"exclude": ["node_modules", "dist"],
"include": ["src"]
"include": ["src", "**/*.d.ts"]
}

View File

@@ -1,3 +1,4 @@
{
"extends": "./tsconfig-esm.json"
}

View File

@@ -12,11 +12,12 @@ const shared = {
correctVarValueBeforeDeclaration: true, //need this to treeshake esm discord.js empty import
annotations: true,
},
dts: false
};
export default defineConfig([
{
format: 'esm',
target: 'node16',
target: 'node18',
tsconfig: './tsconfig-esm.json',
outDir: './dist/esm',
splitting: true,
@@ -37,7 +38,7 @@ export default defineConfig([
format: 'cjs',
esbuildPlugins: [ifdefPlugin({ variables: { MODE: 'cjs' }, verbose: true })],
splitting: false,
target: 'node16',
target: 'node18',
tsconfig: './tsconfig-cjs.json',
outDir: './dist/cjs',
outExtension() {
@@ -50,10 +51,12 @@ export default defineConfig([
await writeFile('./dist/cjs/package.json', JSON.stringify({ type: 'commonjs' }));
},
...shared,
},
// {
// dts: true,
// entry: ['src/presets/*.ts' ]
//
// }
},
{
dts: {
only: true
},
entry: ['src/index.ts'],
outDir: 'dist'
}
]);