Skip to content

Commit adbcc52

Browse files
committed
update compiler output setup
1 parent ddeed6f commit adbcc52

File tree

5 files changed

+36
-69
lines changed

5 files changed

+36
-69
lines changed

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "@hivemq/ui-library",
3-
"version": "2.0.0-rc.2",
3+
"version": "2.0.0-rc.3",
44
"type": "module",
55
"main": "./dist/index.es.js",
66
"types": "./dist/index.d.ts",
77
"publishConfig": {
88
"types": "./dist/index.d.ts",
99
"module": "./dist/index.es.js"
1010
},
11+
"license": "Apache-2.0",
1112
"files": [
1213
"dist"
1314
],
@@ -16,9 +17,9 @@
1617
"pnpm": "9"
1718
},
1819
"scripts": {
19-
"build": "pnpm build:scripts",
20-
"build:scripts": "vite build",
21-
"build:types": "tsc --emitDeclarationOnly && tsc-alias",
20+
"build": "pnpm build:types && pnpm build:lib",
21+
"build:lib": "vite build",
22+
"build:types": "tsc --emitDeclarationOnly",
2223
"build:styles": "NODE_ENV=production pnpm tailwindcss -i ./src/styles/globals.css -o ./dist/styles.css --postcss --minify",
2324
"publish:ci": "pnpm publish --no-git-checks",
2425
"publish:dry": "pnpm publish --no-git-checks --dry-run",
@@ -70,11 +71,9 @@
7071
"react-dom": "^18.3.1",
7172
"storybook": "^8.6.8",
7273
"tailwindcss": "^4.0.15",
73-
"tsc-alias": "^1.8.11",
7474
"typescript": "^5.8.2",
7575
"vite": "^6.2.2",
76-
"vite-plugin-dts": "4.5.3",
77-
"vite-plugin-static-copy": "^2.3.0",
76+
"vite-plugin-dts": "^4.5.3",
7877
"vitest": "^3.0.9"
7978
},
8079
"peerDependencies": {

pnpm-lock.yaml

Lines changed: 1 addition & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tsconfig.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,35 @@
22
"compilerOptions": {
33
"target": "ES2022",
44
"useDefineForClassFields": true,
5-
"lib": [
6-
"ES2022",
7-
"DOM",
8-
"DOM.Iterable"
9-
],
5+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
106
"module": "ESNext",
117
"skipLibCheck": true,
128
/* Bundler mode */
139
"moduleResolution": "bundler",
1410
"allowImportingTsExtensions": true,
11+
"allowSyntheticDefaultImports": true,
12+
"resolveJsonModule": true,
1513
"isolatedModules": true,
16-
"moduleDetection": "force",
1714
"noEmit": true,
1815
"jsx": "react-jsx",
19-
"paths": {
20-
"~/*": [
21-
"./src/*"
22-
]
23-
},
16+
"outDir": "dist",
17+
"declaration": true,
18+
"declarationMap": true,
2419
/* Linting */
2520
"strict": true,
2621
"noUnusedLocals": true,
2722
"noUnusedParameters": true,
2823
"noFallthroughCasesInSwitch": true,
29-
"noUncheckedSideEffectImports": true
24+
"noUncheckedSideEffectImports": true,
25+
"baseUrl": ".",
26+
"paths": {
27+
"~/*": ["src/*"]
28+
}
3029
},
31-
"include": [
32-
"src"
30+
"include": ["src", "index.ts"],
31+
"references": [
32+
{
33+
"path": "./tsconfig.node.json"
34+
}
3335
]
3436
}

tsconfig.node.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": ["vite.config.ts"]
10+
}

vite.config.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,29 @@
11
import { resolve } from 'node:path'
2-
32
import react from '@vitejs/plugin-react'
43
import { defineConfig } from 'vite'
54
import dts from 'vite-plugin-dts'
6-
75
import packageData from './package.json'
86

9-
type BuildEnvironment = 'storybook' | 'library'
10-
11-
const buildEnvironment: BuildEnvironment = (process.env.BUILD_ENV as BuildEnvironment) || 'library'
12-
137
const libPlugins = [
148
react(),
159
dts({
1610
rollupTypes: true,
1711
}),
1812
]
1913

20-
const storybookPlugins = [
21-
react({
22-
jsxRuntime: 'automatic',
23-
}),
24-
]
25-
2614
// https://vitejs.dev/config/
2715
export default defineConfig({
28-
plugins: buildEnvironment === 'storybook' ? storybookPlugins : libPlugins,
16+
plugins: libPlugins,
2917
build: {
3018
lib: {
3119
entry: resolve(__dirname, 'index.ts'),
3220
formats: ['es'],
3321
fileName: (format) => `index.${format}.js`,
3422
},
3523
rollupOptions: {
36-
external:
37-
buildEnvironment === 'storybook' ? [] : [...Object.keys(packageData.peerDependencies)],
38-
output: {
39-
// Since we publish our ./src folder, there's no point
40-
// in bloating sourcemaps with another copy of it.
41-
sourcemapExcludeSources: true,
42-
},
24+
// make sure to externalize peer dependencies that shouldn't be bundled
25+
external: Object.keys(packageData.peerDependencies),
4326
},
44-
target: 'esnext',
45-
sourcemap: true,
46-
minify: false,
4727
},
4828
resolve: {
4929
alias: {

0 commit comments

Comments
 (0)