On this page

Parser options for javascript modules.

Type:false | { [index: string]: any }

Set the value of require.amd and define.amd. Or disable AMD support.

Type:boolean

Set .name to "default" for anonymous default export functions and classes per ES spec. Disable to reduce output size when .name is not needed.

Type:boolean

Enable/disable special handling for browserify bundles.

Type:boolean

Enable/disable parsing of CommonJs syntax.

Type:boolean

Enable/disable parsing of magic comments in CommonJs syntax.

Enable/disable parsing "import createRequire from "module"" and evaluating createRequire().

Type:boolean

Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use.

Auto-emit <link rel="preload" as="style"> for the CSS of every dynamically imported (import()) chunk, so the stylesheet fetches in parallel with the chunk's JavaScript instead of after it parses. Unlike dynamicImportPreload, the JavaScript itself is not preloaded. true uses the default order; a number sets the preload order.

Type:false | "auto" | "high" | "low"

Specifies global fetchPriority for dynamic import.

Type:"eager" | "weak" | "lazy" | "lazy-once"

Specifies global mode for dynamic import.

Specifies global prefetch for dynamic import.

Specifies global preload for dynamic import.

Type:boolean

Enable/disable parsing of dynamic URL.

Type:false | "error" | "warn" | "auto"

Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".

Type:boolean

Enable warnings for full dynamic dependencies.

Type:boolean

Enable recursive directory lookup for full dynamic dependencies.

Sets the default regular expression for full dynamic dependencies.

Type:string

Set the default request for full dynamic dependencies.

Type:boolean

Enable/disable parsing of EcmaScript Modules syntax.

Type:boolean

Enable/disable parsing of import() syntax.

Type:false | "error" | "warn" | "auto"

Specifies the behavior of invalid export names in "import ... from ...".

Type:boolean | "preserve-unknown" | ImportMetaParserOptions

Enable/disable evaluating import.meta. Set to 'preserve-unknown' or an object to preserve unknown properties for runtime evaluation.

Stability: 0Deprecated
Type:boolean

Deprecated in favor of "importMeta" object option with a "webpackContext" field. Enable/disable evaluating import.meta.webpackContext.

Type:false | NodeOptions

Include polyfills or mocks for various node stuff.

Type:"strict" | "non-strict"

Override the module to strict or non-strict. This may affect the behavior of the module (some behaviors differ between strict and non-strict), so please configure this option carefully.

javascriptParserOptions.parse(code, options): ParseResult
Attributes
code:string
options:ParseOptions
Returns:ParseResult

Function to parser source code.

Type:string[]

Mark the listed top-level function names for pure-function-based tree shaking.

Type:false | "error" | "warn" | "auto"

Specifies the behavior of invalid export names in "export ... from ...". This might be useful to disable during the migration from "export ... from ..." to "export type ... from ..." when reexporting types in TypeScript.

Type:boolean

Enable/disable parsing of require.context syntax.

Type:boolean

Enable/disable parsing of require.ensure syntax.

Type:boolean

Enable/disable parsing of require.include syntax.

Type:boolean

Enable/disable parsing of require.js special syntax like require.config, requirejs.config, require.version and requirejs.onError.

Type:boolean

Enable experimental tc39 proposal https://github.com/tc39/proposal-source-phase-imports. This allows importing modules at source phase.

Stability: 0Deprecated
Type:boolean

Deprecated in favor of "exportsPresence". Emit errors instead of warnings when imported names don't exist in imported module.

Type:false | "error" | "warn"

Specifies the behavior of constructs that break at runtime in strict mode (e.g. 'with', 'arguments.callee', assigning to read-only globals) when modules are emitted as ES module output.

Type:boolean

Handle the this context correctly according to the spec for namespace objects.

Type:boolean

Enable/disable parsing of System.js special syntax like System.import, System.get, System.set and System.register.

Stability: 1Experimental
Type:boolean

Enable typescript support.

Type:boolean

Enable warnings when using the require function in a not statically analyse-able way.

Type:boolean

Enable recursive directory lookup when using the require function in a not statically analyse-able way.

Sets the regular expression when using the require function in a not statically analyse-able way.

Type:string

Sets the request when using the require function in a not statically analyse-able way.

Type:boolean | "relative"

Enable/disable parsing of new URL() syntax.

URL-referenced-asset default hint rules for this parser (JavaScript new URL(...), CSS url(...), HTML <img src> / <link href> / <script src>).

Type:boolean | string[]

Disable or configure parsing of WebWorker syntax like new Worker() or navigator.serviceWorker.register().

Type:boolean | string[]

Disable or configure parsing of Worklet syntax like context.audioWorklet.addModule() or CSS.paintWorklet.addModule().

Type:boolean

Enable warnings for partial dynamic dependencies.

Type:boolean

Enable recursive directory lookup for partial dynamic dependencies.

Type:RegExp

Set the inner regular expression for partial dynamic dependencies.