CompilerOptions
CompilerOptions =
object
Defined in: compiler-options.ts:19
Properties
additionalFiles?
optionaladditionalFiles:Record<string,string>
Defined in: compiler-options.ts:154
The additionalFiles option is an array of paths to additional files that should be copied to the output directory.
Example
The output will look like this:
cleanOutdir?
optionalcleanOutdir:boolean
Defined in: compiler-options.ts:260
Whether to clean the output directory before writing the new files.
Default
cookieDomain?
optionalcookieDomain:string
Defined in: compiler-options.ts:128
The host to which the cookie will be sent. If undefined or empty, the domain attribute is omitted from the cookie, scoping it to the exact current domain only (no subdomains). If specified, the cookie will be available to the specified domain and all its subdomains.
Use this when you need cookies to be shared across subdomains (e.g., between app.example.com and api.example.com).
The default behavior (no domain) ensures better compatibility with server-side cookies that don't specify a domain attribute.
Example
Default
cookieMaxAge?
optionalcookieMaxAge:number
Defined in: compiler-options.ts:108
The max-age in seconds of the cookie until it expires.
Default
cookieName?
optionalcookieName:string
Defined in: compiler-options.ts:102
The name of the cookie to use for the cookie strategy.
Default
disableAsyncLocalStorage?
optionaldisableAsyncLocalStorage:boolean
Defined in: compiler-options.ts:189
Replaces AsyncLocalStorage with a synchronous implementation.
⚠️ WARNING: This should ONLY be used in serverless environments like Cloudflare Workers.
Disabling AsyncLocalStorage in traditional server environments risks cross-request pollution where state from one request could leak into another concurrent request.
emitGitIgnore?
optionalemitGitIgnore:boolean
Defined in: compiler-options.ts:203
If emitGitIgnore is set to true a .gitignore file will be emitted in the output directory. Defaults to true.
Default
emitPrettierIgnore?
optionalemitPrettierIgnore:boolean
Defined in: compiler-options.ts:168
If emitPrettierIgnore is set to true a .prettierignore file will be emitted in the output directory. Defaults to true.
Default
experimentalMiddlewareLocaleSplitting?
optionalexperimentalMiddlewareLocaleSplitting:boolean
Defined in: compiler-options.ts:77
Whether or not to use experimental middleware locale splitting.
⚠️ This feature is experimental and only works in SSR/SSG environment without client-side routing. Do not rely on this feature for production.
This feature is part of the exploration of per locale splitting. The issue is ongoing and can be followed here #88.
- The client bundle will tree-shake all messages (have close to 0kb JS).
- The server middleware will inject the used messages into the HTML.
- The client will re-trieve the messages from the injected HTML.
Default
fs?
optionalfs:any
Defined in: compiler-options.ts:267
The file system to use. Defaults to await import('node:fs').
Useful for testing the paraglide compiler by mocking the fs.
includeEslintDisableComment?
optionalincludeEslintDisableComment:boolean
Defined in: compiler-options.ts:178
Whether to include an eslint-disable comment at the top of each .js file.
Default
isServer?
optionalisServer:string
Defined in: compiler-options.ts:96
Tree-shaking flag if the code is running on the server.
Dependent on the bundler, this flag must be adapted to enable tree-shaking.
Example
Default
localStorageKey?
optionallocalStorageKey:string
Defined in: compiler-options.ts:83
The name of the localStorage key to use for the localStorage strategy.
Default
outdir
outdir:
string
Defined in: compiler-options.ts:43
The path to the output directory.
Example
outputStructure?
optionaloutputStructure:"locale-modules"|"message-modules"
Defined in: compiler-options.ts:254
The outputStructure defines how modules are structured in the output.
message-modules- Each module is a message. This is the default.locale-modules- Each module is a locale.
It is recommended to use locale-modules for development and message-modules for production.
Bundlers speed up the dev mode by bypassing bundling which can lead to many http requests
during the dev mode with message-modules. See https://github.com/opral/inlang-paraglide-js/issues/486.
message-modules
Messages have their own module which eases tree-shaking for bundlers.
locale-modules
Messages are bundled in a per locale module. Bundlers often struggle with tree-shaking this structure,
which can lead to more inefficient tree-shaking and larger bundle sizes compared to message-modules.
The benefit are substantially fewer files which is needed in large projects.
Default
project
project:
string
Defined in: compiler-options.ts:31
The path to the inlang project.
Example
strategy?
optionalstrategy:Runtime["strategy"]
Defined in: compiler-options.ts:61
The strategy to use for getting the locale.
The order of the strategy defines the precedence of matches.
For example, in ['url', 'cookie', 'baseLocale'], the locale will be
first tried to be detected in the url, then in a cookie, and finally
fallback to the base locale.
The default ensures that the browser takes a cookie approach, server-side takes the globalVariable (because cookie is unavailable), whereas both fallback to the base locale if not available.
Custom strategies with the pattern custom-[A-Za-z0-9]+ are supported.
Default
urlPatterns?
optionalurlPatterns:Runtime["urlPatterns"]
Defined in: compiler-options.ts:172
https://inlang.com/m/gerre34r/library-inlang-paraglideJs/strategy#url
defaultCompilerOptions
constdefaultCompilerOptions:object
Defined in: compiler-options.ts:3
Type Declaration
cleanOutdir
readonlycleanOutdir:true=true
cookieDomain
readonlycookieDomain:""=""
cookieMaxAge
readonlycookieMaxAge:number
cookieName
readonlycookieName:"PARAGLIDE_LOCALE"="PARAGLIDE_LOCALE"
disableAsyncLocalStorage
readonlydisableAsyncLocalStorage:false=false
emitGitIgnore
readonlyemitGitIgnore:true=true
emitPrettierIgnore
readonlyemitPrettierIgnore:true=true
experimentalMiddlewareLocaleSplitting
readonlyexperimentalMiddlewareLocaleSplitting:false=false
includeEslintDisableComment
readonlyincludeEslintDisableComment:true=true
isServer
readonlyisServer:"typeof window === 'undefined'"="typeof window === 'undefined'"
localStorageKey
readonlylocalStorageKey:"PARAGLIDE_LOCALE"="PARAGLIDE_LOCALE"
outputStructure
readonlyoutputStructure:"message-modules"="message-modules"
strategy
readonlystrategy: ["cookie","globalVariable","baseLocale"]


