unplugin-atscript
v0.1.107
Published
Atscript: Configuration and build plugins.
Maintainers
Readme
Build tool plugin that compiles .as files during development. Works with Vite, Webpack, Rollup, Rolldown, esbuild, Rspack, and Farm via Unplugin.
Installation
pnpm add -D unplugin-atscript @atscript/typescript @atscript/coreQuick Start
// vite.config.ts
import atscript from 'unplugin-atscript/vite'
export default { plugins: [atscript()] }
// rollup.config.js
import atscript from 'unplugin-atscript/rollup'
export default { plugins: [atscript()] }
// webpack.config.js
const atscript = require('unplugin-atscript/webpack')
module.exports = { plugins: [atscript()] }Also available: unplugin-atscript/esbuild, unplugin-atscript/rolldown, unplugin-atscript/rspack, unplugin-atscript/farm.
Options
Same options on every bundler entry:
| Option | Type | Default | Effect |
| -------- | --------- | ------------------- | -------------------------------------------------------------------------------------- |
| strict | boolean | true | Fail the build on parse/diagnostic errors. false = log errors but keep building. |
| root | string | bundler root or cwd | Directory atscript.config.* is discovered from. Absolute, or relative to the cwd. |
Vite picks the root up automatically (from configResolved); other bundlers need root when the working directory is not the project root.
Features
- Universal bundler support via dedicated entry points
- Automatic
atscript.config.*loading - Strict validation — build fails on
.aserrors by default (strict: falseto disable) - Tree-shaking aware — marks non-mutating modules as side-effect-free
- On Vite, prebundles
@atscript/typescript/utilsso the first.as-backed route does not trigger a dep re-optimization reload - Watch-safe in dev — a changed
.asfile is dropped from the document cache and every transitive.asimport is registered as a watch file, so dependants are re-checked against the new definition on the next reload (esbuild excepted: unplugin has nowatchChangefor it, so under esbuild watch a changed.asimport still needs a restart)
Documentation
License
MIT
