this is something that I used to do in gulp and webpack but I'm not able to achieve this on vite.
I have different themes in different folders like
resources/
themes/
theme1/
js/
css/
theme2/
js/
css/
I'm trying to build files in their separate folders based on theme name like this should be the output
public/
build/
theme1/
theme2/
I've tried to follow a lot of forums but couldn't get the code to work. I also tried using vitemulti builder but there must be something I'm missing. This is my code
export default defineConfig({
resolve: {
alias: {
'resources/themes/default/sass/app.scss': '/resources/themes/default/css/app.css',
},
},
plugins: [
vue(),
laravel({
input: [
'resources/themes/theme1/sass/app.scss',
'resources/themes/theme1/js/app.js',
'resources/themes/theme2/sass/app.scss',
'resources/themes/theme2/js/app.js',
],
refresh: true,
}),
/*viteMultiBundler({
file_versioning: true,
js: [
{
filename: "theme1",
entryPoints: ['resources/themes/theme1/js/app.js'],
},
{
filename: "theme2",
entryPoints: ['resources/themes/theme2/js/app.js'],
}
],
sass: [
{
filename: "theme1",
entryPoints: ['resources/themes/theme1/sass/app.scss'],
},
{
filename: "theme2",
entryPoints: ['resources/themes/theme2/sass/app.scss'],
}
]
}),*/
],
});
Can anyone help me achieve the desired output?
In Vite, you can use the
build.rollupOptions
configuration to specify multiple input files and their output paths.In this configuration, the
build.rollupOptions.input
option is used to specify the input files and their output paths. The keys of theinput
object are the output paths relative to theoutDir
(which defaults todist
), and the values are the corresponding input file paths.