Skip to main content

bud.entry

bud.entry is used to specify and group assets to include in the compilation.

If no entrypoint is provided bud.js will attempt to compile src/index.js to dist/main.js.

Usage

The simplest usage is a string reference to your application's entrypoint.

export default async bud => {
bud.entry('app')
}

For more control over naming, you may pass two parameters. The first will be used as the name, and the second as the asset signifier.

export default async bud => {
bud.entry('app', 'app.js')
}

It is also possible to pass an array of assets (with or without an entrypoint name). Assets do not have to be the same filetype to be grouped together as a single entrypoint.

export default async bud => {
bud.entry('app', ['app.js', 'app.css'])
}

You may also specify multiple entrypoints in one call using object syntax:

export default async bud => {
bud.entry({
app: ['app.js', 'app.css'],
admin: ['admin.js', 'admin.css'],
})
}

The entire EntryObject API is available to you.

As an example, you might use publicPath to specify a CDN for your a particular entry.

export default async bud => {
bud.entry({
react: ['react', 'react-dom'],
app: {
import: ['app.js', 'app.css'],
dependOn: ['react'],
publicPath: 'https://cdn.example.com/app/',
},
})
}

Globbing

bud.entry can be used with bud.glob to find matching files.

export default async bud => {
bud.entry({
app: await bud.glob('./src/*.{css,js}'),
})
}