drn-buildwww-vite
Build system configuration for DRN `buildwww` Vite projects.
Install
mkdir -p .claude/skills/drn-buildwww-vite && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17611" && unzip -o skill.zip -d .claude/skills/drn-buildwww-vite && rm skill.zipInstalls to .claude/skills/drn-buildwww-vite
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
DRN buildwww Vite build system - multi-build configuration, TypeScript aliases, wwwroot output, appPreload/appPostload, and Vite manifest discovery. Keywords: drn, buildwww, vite, typescript, bundling, asset-compilation, npm, javascript, css, scss, build-pipeline, entry-points, manifestKey capabilities
- →Configure frontend build using Vite and TypeScript
- →Manage multi-build configurations for different outputs
- →Define TypeScript path aliases for source files
- →Output built assets to a `wwwroot` directory
- →Handle `appPreload.js` and `appPostload.js` for script loading
- →Discover Vite manifest files for asset resolution
How it works
The skill configures Vite for multi-build setups, TypeScript aliases, and `wwwroot` output, managing frontend asset compilation for projects following the DRN `buildwww` convention. It uses `rolldownOptions` for bundling and defines specific entry points.
Inputs & outputs
When to use drn-buildwww-vite
- →Setting up frontend build configs
- →Adding TypeScript aliases
- →Optimizing asset compilation
About this skill
DRN buildwww & Vite
Frontend build system using Vite and TypeScript for repositories that declare the DRN
buildwwwconvention.
When to Apply
- Configuring frontend build
- Adding new JavaScript/TypeScript files
- Modifying Vite build configuration
- Working with path aliases
- Understanding build output structure
Directory Structure
<frontend-package>/
├── buildwww/ # Source files (not served)
│ ├── app/ # Application code
│ │ ├── js/ # JavaScript modules
│ │ │ ├── drn/ # Application utilities
│ │ │ ├── appPreload.js
│ │ │ └── appPostload.js
│ │ └── css/ # Application CSS
│ ├── lib/ # Library code
│ │ ├── htmx/ # htmx bundle
│ │ ├── bootstrap/ # Bootstrap customization
│ │ └── react/ # React mounted islands (Shadow DOM + Tailwind)
│ ├── plugins/ # Vite plugins
│ └── types/ # TypeScript declarations
├── wwwroot/ # Built output (served)
│ ├── app/ # Built app files
│ └── lib/ # Built library files
├── vite.config.js # Vite configuration
├── tsconfig.json # TypeScript configuration
├── package.json # npm dependencies
└── package-lock.json
Vite Configuration
Multi-Build Setup
// vite.config.js — uses rolldownOptions (Vite 6+ with Rolldown)
const builds = {
app: {
plugins: [iifeWrap()],
build: {
outDir: 'wwwroot/app',
rolldownOptions: {
input: {
app: resolve(__dirname, 'buildwww/app/css/app.css'),
appPreload: resolve(__dirname, 'buildwww/app/js/appPreload.js')
}
}
}
},
appPostload: {
plugins: [iifeWrap()],
build: {
outDir: 'wwwroot/appPostload',
rolldownOptions: {
input: {
appPostload: resolve(__dirname, 'buildwww/app/js/appPostload.js')
}
}
}
},
htmx: {
plugins: [iifeWrap(), stripHtmxEval()],
build: {
outDir: 'wwwroot/lib/htmx',
rolldownOptions: {
input: {
htmxBundle: resolve(__dirname, 'buildwww/lib/htmx/htmxBundle.js')
}
}
}
},
bootstrap: {
build: {
outDir: 'wwwroot/lib/bootstrap',
rolldownOptions: {
input: {
bootstrap: resolve(__dirname, 'buildwww/lib/bootstrap/bootstrap.scss'),
bootstrapBundle: resolve(__dirname, 'buildwww/lib/bootstrap/bootstrapBundle.js')
}
}
},
plugins: [iifeWrap()]
},
react: {
plugins: [react(), tailwindcss()],
build: {
outDir: 'wwwroot/lib/react',
rolldownOptions: {
input: {
reactBundle: resolve(__dirname, 'buildwww/lib/react/reactBundle.tsx')
},
output: { format: 'iife', name: 'DrnReactMicroFrontend' }
}
}
}
};
// Select build via environment variable
const buildType = process.env.BUILD_TYPE || 'app';
See drn-buildwww-react for the full React build architecture (Shadow DOM, Tailwind 4, IIFE format rationale).
Build Commands
Repository rule: do not run build commands unless the user explicitly allows them.
# Build all targets
npm run build
# Or build individual targets
npm run build:app
npm run build:appPostload
npm run build:htmx
npm run build:bootstrap
npm run build:react
CI validation runs .github/actions/frontend-build in parallel with backend checks. Release workflows run it before .NET build/test and publishing so generated wwwroot assets stay in the release job workspace.
Shared Configuration
const sharedConfig = {
base: '/',
build: {
emptyOutDir: true,
manifest: true,
rolldownOptions: {
output: {
entryFileNames: `[name].[hash:16].js`,
chunkFileNames: `[name].[hash:16].js`,
assetFileNames: `[name].[hash:16].[ext]`
}
}
},
resolve: {
alias: {
'@css': resolve(__dirname, 'buildwww/app/css'),
'@js': resolve(__dirname, 'buildwww/app/js'),
'@lib': resolve(__dirname, 'buildwww/lib'),
'@types': resolve(__dirname, 'buildwww/types'),
'@plugins': resolve(__dirname, 'buildwww/plugins')
}
}
};
// Per-build configs are deep-merged with sharedConfig
export default defineConfig(drnUtils.deepMerge(sharedConfig, builds[buildType]));
Note: TypeScript path alias
@/*→buildwww/*is configured intsconfig.jsonand resolved bymoduleResolution: "bundler". The Viteresolve.aliasentries above mirror the actualbuildwww/app,buildwww/lib,buildwww/types, andbuildwww/pluginslayout. No rootbuildwww/js,buildwww/css,buildwww/ts, orbuildwww/scssdirectories are assumed.
TypeScript Configuration
{
"compilerOptions": {
"target": "ES2023",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"allowJs": true,
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"paths": {
"@/*": ["./buildwww/*"],
"@js/*": ["./buildwww/app/js/*"],
"@css/*": ["./buildwww/app/css/*"],
"@lib/*": ["./buildwww/lib/*"],
"@types/*": ["./buildwww/types/*"],
"@plugins/*": ["./buildwww/plugins/*"]
},
"typeRoots": ["./buildwww/types", "./node_modules/@types"]
},
"include": [
"buildwww/app/**/*",
"buildwww/lib/**/*",
"buildwww/types/**/*"
],
"exclude": ["node_modules", "wwwroot/dist"]
}
Package Configuration
Detailed package versioning and dependency definitions are managed in:
Entry Points
Current builds are app, appPostload, htmx, bootstrap, and react.
appPreload.js
Loaded early, before page content:
- Critical initializations
- Theme setup
- Cookie consent checks
appPostload.js
Loaded after page content:
- Event handlers
- DOM manipulations
- Non-critical scripts
Output Structure
wwwroot/
├── app/
│ ├── appPreload.[hash].js
│ ├── app.[hash].css
│ └── .vite/manifest.json
├── appPostload/
│ ├── appPostload.[hash].js
│ └── .vite/manifest.json
├── lib/
│ ├── htmx/
│ │ ├── htmxBundle.[hash].js
│ │ └── .vite/manifest.json
│ ├── bootstrap/
│ │ ├── bootstrap.[hash].css
│ │ ├── bootstrapBundle.[hash].js
│ │ └── .vite/manifest.json
│ └── react/
│ ├── reactBundle.[hash].js
│ └── .vite/manifest.json
Using Built Assets in Razor
<script src="buildwww/app/js/appPreload.js"></script>
<link href="buildwww/app/css/app.css" rel="stylesheet" />
<link href="buildwww/lib/bootstrap/bootstrap.scss" rel="stylesheet" />
<script src="buildwww/lib/htmx/htmxBundle.js"></script>
<script src="buildwww/lib/bootstrap/bootstrapBundle.js"></script>
<script src="buildwww/app/js/appPostload.js"></script>
<script src="buildwww/lib/react/reactBundle.tsx"></script>
TagHelpers resolve these source paths through the per-output .vite/manifest.json files and emit content-hashed wwwroot paths with SRI where applicable.
Runtime manifest discovery is source-owned by DRN.Framework.Hosting.Utils.Vite.ViteManifest. DRN Hosting currently discovers Vite's default .vite/manifest.json files below the active web root, or ContentRootPath/wwwroot when the web root is empty. When changing environment defaults, publish behavior, or static-web-asset roots, verify that the running app can still see the Vite manifests; a rendered page can otherwise be missing CSS/JS even when server startup succeeds.
Related Skills
- overview-ddd-architecture.md - Architecture guidance
- drn-buildwww-libraries.md - Library usage
- drn-buildwww-react.md - React build architecture
- drn-buildwww-packages.md - Package dependencies
- frontend-razor-pages-shared.md - Layout integration
When not to use it
- →When not using the DRN `buildwww` convention
- →When not using Vite as the build system
- →When not using TypeScript for frontend development
Limitations
- →Requires adherence to the DRN `buildwww` convention
- →Assumes Vite as the build system
- →Requires TypeScript for path alias resolution
How it compares
This skill provides a specialized Vite configuration tailored for the DRN `buildwww` convention, including multi-build support and specific output structures, unlike a generic Vite setup.
Compared to similar skills
drn-buildwww-vite side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| drn-buildwww-vite (this skill) | 0 | 20d | Review | Intermediate |
| pwa-development | 9 | 3mo | Caution | Intermediate |
| playwright-pro | 8 | 2mo | Review | Intermediate |
| add-cdn-bundle | 1 | 5mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
pwa-development
alinaqi
Progressive Web Apps - service workers, caching strategies, offline, Workbox
playwright-pro
alirezarezvani
Production-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migration, CI/CD testing, or test suites. Generate tests, fix flaky failures, migrate from Cypress/Selenium, sync with TestRail, run on BrowserStack. 55 templates, 3 agents, smart reporting.
add-cdn-bundle
getsentry
Create a new CDN bundle for the browser package with specified features
oly-apps
slaveOftime
Use when building a web app/api to present rich output or interactive experiences to users.
vite-patterns
Fmarzochi
Vite build tool patterns including config, plugins, HMR, env variables, proxy setup, SSR, library mode, dependency pre-bundling, and build optimization. Activate when working with vite.config.ts, Vite plugins, or Vite-based projects.
progressive-centralization-starter
Swader
Bootstrap Bun-based single-file frontends with Filebase/IPFS, ENS, and Arweave/ArNS deploy tooling. Use when creating a progressive centralization starter project, setting up .env-driven deploys, or when the user asks to "just do it" for IPFS/ENS/Arweave hosting.