Uses Parcel to handle asset bundling for Fractal component libraries.
npm i --save-dev @frctl/fractalite-plugin-assets-bundler
// fractal.config.js
module.exports = {
// ...
plugins: [
require('@frctl/fractalite-plugin-assets-bundler')({
entryFile: './src/preview.js',
outFile: './dist/build.js'
})
]
};
// ./assets/preview.js
import '../components/**/*.scss'
import button from '../components/@button/button.js'
See the Parcel docs on module resolution for more info on paths, globbing and aliases: https://parceljs.org/module_resolution.html
The asset bundler handles serving assets and injecting them into your component previews so no further configuration is needed.