Skip to main content

Adding compiler sources

By default, bud.js only resolves source code from the @src directory.

Nearly all of the modules you install will have been compiled before they are published. It's almost always a waste to run this code through Babel or whatever other compiler you may be using.

Nevertheless, some packages expect to be compiled from source. We can allow for this with the API.

Common examples:

  • highlight.js
  • swiper
  • various scss frameworks
  • a project that needs to source modules from multiple directories

Adding sources

Use bud.compilePaths to add additional directories to the list of sources that will be compiled.

As a quick example, let's say we have a project that needs to source modules from the swiper package.:

import type {Bud} from '@roots/bud'

export default async (bud: Bud) => {