Azion Bundler.config.js file

The bundler.config.js file serves as a powerful configuration system for Azion Bundler, offering customization options for your application’s build process. While not mandatory, this file acts as an override mechanism, allowing you to define properties that supersede preset configurations.


Properties

PropertyTypeDescriptionAdditional Information
EntryStringRepresents the primary entry point for your application, where the building process beginsEntry will be ignored for Jamstack solutions
BuilderStringDefines the build tool to useOptions:
'esbuild'
'webpack'
CustomObjectAllows extending the capabilities of the chosen bundler (webpack or esbuild) with custom plugins or configurationsProperties:
Plugins (Object): Add custom plugins for the chosen bundler here.
All properties related to the chosen bundler
UseNodePolyfillsBooleanDetermines whether Node.js polyfills should be appliedUseful for projects leveraging Node.js functionalities targeting environments without built-in capabilities
UseOwnWorkerBooleanIndicates that the constructed code inserts its own worker expression, eliminating the need to inject a providerExample: Hono framework
PresetObjectProvides preset-specific configurationsProperties:
Name (String): refers to the preset name (example: "vue" or "next").
Mode (String): specifies the mode for the preset (example: "compute" or "deliver")
MemoryFSObjectConfigurations related to the in-memory filesystemProperties:
InjectionDirs (Array of Strings): directories injected into memory for runtime access via the fs API.
RemovePathPrefix (String): prefix path to be removed from files before injecting into memory
CustomObjectAllows extending the capabilities of the chosen bundler (webpack or esbuild) with custom plugins or configurationsProperties:
Plugins (Object): add custom plugins for the chosen bundler here.
All properties related to the chosen bundler can be used

Azion Bundler employs the terminology compute and deliver to describe the operational modes of applications:

ModeDescription
ComputeDesigned for applications that require computational processing at the edge, whether it’s for Front-End Server-Side Rendering (SSR) or Back-End tasks. In Compute Mode, Azion enables the execution of code and processing of dynamic content at the edge to enhance performance and responsiveness.
DeliverTailored for frameworks that primarily focus on handling and routing incoming requests at the edge, with an emphasis on efficiently serving static files. While applications in Deliver Mode don’t execute dynamic code, they excel in optimizing the delivery of static content to end-users, thereby ensuring smooth and fast content distribution.

Configuration

For a Next-based project:

bundler.config.js
module.exports = {
entry: 'src/index.js',
builder: 'webpack',
useNodePolyfills: true,
useOwnWorker: false,
preset: {
name: 'next',
mode: 'compute',
},
memoryFS: {
injectionDirs: ['.faststore/@generated/graphql'],
removePathPrefix: '.faststore/',
},
custom: {
plugins: {},
},
};

Go to an implementation of the bundler.config.js file

Compatibility

Learn more about compatibility on the Azion Edge Platform.

Go to supported Web Frameworks Go to supported Web APIs Go to node.js support reference

Contributors