Skip to content

Commit

Permalink
perf: build
Browse files Browse the repository at this point in the history
  • Loading branch information
hemengke1997 committed Oct 26, 2023
1 parent 2935021 commit b0fa263
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"peerDependencies": {
"postcss": ">=8.0.0"
},
"dependencies": {
"decode-uri-component": "^0.4.1",
"split-on-first": "^3.0.0"
},
"devDependencies": {
"@commitlint/cli": "^18.0.0",
"@minko-fe/commitlint-config": "^2.0.4",
Expand All @@ -61,13 +65,11 @@
"bumpp": "^9.2.0",
"conventional-changelog-cli": "^2.2.2",
"cross-env": "^7.0.3",
"decode-uri-component": "^0.4.1",
"eslint": "^8.50.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.4.30",
"postcss-nested": "^6.0.1",
"simple-git-hooks": "^2.9.0",
"split-on-first": "^3.0.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vite": "^4.4.9",
Expand Down
17 changes: 9 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import { defineConfig } from 'tsup'
import { type Options, defineConfig } from 'tsup'

export const tsup = defineConfig((option) => ({
const commonConfig = (option: Options): Options => ({
entry: ['src/index.ts'],
target: 'node16',
dts: !option.watch,
clean: true,
format: ['cjs', 'esm'],
minify: false,
sourcemap: !!option.watch,
esbuildOptions: (options) => {
// postcss plugin export default plugin config
if (options.format === 'cjs') {
})

export const tsup = defineConfig((option) => [
{
format: ['esm'],
...commonConfig(option),
},
{
noExternal: ['decode-uri-component', 'split-on-first'],
format: ['cjs'],
esbuildOptions: (options) => {
// postcss plugin export default plugin config
options.footer = {
js: 'module.exports = module.exports.default;',
}
}
},
...commonConfig(option),
},
}))
])

0 comments on commit b0fa263

Please sign in to comment.