rollup-plugin-bundle-cep-manifest v1.0.1
rollup-plugin-bundle-cep-manifest
A Rollup plugin to bundle the CSXS folder, including the manifest.xml file, to the dist folder.
It also updates the paths in the manifest.xml
file to match the new location of the files in the dist
folder. For example:
Tip: Better used with Vite :)
Installation
npm install rollup-plugin-bundle-cep-manifest
Usage
With Rollup (rollup.config.js):
import { bundleManifest } from 'rollup-plugin-bundle-cep-manifest';
export default {
plugins: [
bundleManifest(),
],
};
With Vite (vite.config.js):
import { defineConfig } from 'vite';
import { bundleManifest } from 'rollup-plugin-bundle-cep-manifest';
export default defineConfig({
build: {
rollupOptions: {
plugins: [
bundleManifest(),
],
},
}
});
Automatic
The plugin updates the paths in the manifest.xml
file to match the new location of the files in the dist
folder. For example:
<MainPath> ./index-dev.html </MainPath>
becomes
<MainPath> ./index.html </MainPath>
When used with Vite
the plugin does a better job at updating the paths, since it knows the final location of the files (Vite bundles html files by default).
When used with Rollup, the plugin will try its best and guess the final location of the files, but it might fail. In that case, you can manually remap the paths (see below).
Manual
To manually convert the paths in your manifest.xml
file, you can use the remap
option:
bundleManifest({
{
remap: {
"./index-dev.html": "./index.html",
}
}),
Note that the final paths (those on the right) should be relative to the dist
folder.
You can specify more than one path to remap:
bundleManifest({
{
remap: {
"./index-dev.html": "./index.html",
"./other-index-dev": "./other-index.js",
}
}),
Enjoy :)