Reputation: 1283
I am using Rollup to bundle my code for production.
I have multiple js files, so I am using the Rollup plugin-multi-entry
plugin to use a glob pattern to target all of my js files.
I am outputting the files in umd
format.
Currently they are being output as one js file, bundled all together, this is the expected behavior, but I would like to out put them all individually as well, transpiled to es5 and in umd format but not concatonated into one js bundle file, how can I do this?
Current setup:
import babel from "rollup-plugin-babel";
import { terser } from "rollup-plugin-terser";
import multi from "@rollup/plugin-multi-entry";
import gzipPlugin from "rollup-plugin-gzip";
export default [{
input: "src/**/*.logic.js",
output: {
dir: "build/assets/js",
format: "umd",
name: "Logic"
},
plugins: [
gzipPlugin(),
multi({
exports: true
}),
babel({
exclude: "node_modules/**"
})
]
}]
Upvotes: 17
Views: 23794
Reputation: 431
If you want multiple builds, have multiple vite config files and run vite build -c different.config.js
Upvotes: 0
Reputation: 1959
https://rollupjs.org/guide/en/#configuration-files
Here's an example:
export default [
{
input: 'main-a.js',
output: {
file: 'dist/bundle-a.js',
format: 'cjs'
}
},
{
input: 'main-b.js',
output: [
{
file: 'dist/bundle-b1.js',
format: 'cjs'
},
{
file: 'dist/bundle-b2.js',
format: 'es'
}
]
}
];
Upvotes: 14
Reputation: 948
You should able to do that with Rollup without any plugins.
Take a look at the code splitting section from their documentation.
Upvotes: 0