Configuration
Fragment will automatically try to resolve a config file named fragment.config.js at the root of the current working directory. This configuration file is optional.
// fragment.config.js
export default {
}A different configuration file path can be provided using the --config flag on the command line:
fragment sketch.js --config custom/path/to/config.jsExtending Vite
Vite's configuration can be extended by adding Vite options under the vite property in the config file.
export default {
vite: {
// vite config options
}
}Refer to Vite's documentation for available configuration options. The final configuration is merged with Fragment's Vite setup using the mergeConfig strategy.
Config Intellisense
Fragment includes TypeScript typings, allowing IDEs to provide Intellisense when using JSDoc type annotations:
/**
* @type {import('fragment-tools').Config}
*/
export default {
}The defineConfig helper can also be used to enable Intellisense support without JSDoc annotations:
import { defineConfig } from 'fragment-tools';
export default defineConfig({
// ...
})TypeScript support
Fragment also supports TypeScript config files with fragment.config.ts.