I understand that I can generate a source map, but I want to generate the rollup output without minification. Is it possible to do this? I've googled and haven't found anybody asking this question.
usually with rollup:
javascript is minified by @rollup/plugin-terser
to disable minifacation of javascript
remove terser()
from the plugins
array in rollup.config.js
by default, CSS is not minified by rollup-plugin-css-only or rollup-plugin-postcss
rollup-plugin-css-only
has no option for minify
css({ output: 'bundle.css' })
rollup-plugin-postcss
has the default option { minimize: false }
postcss({ extract: 'bundle.css' })
other rollup plugins can produce minified CSS, for example rollup-plugin-svelte
as a workaround, to produce pretty CSS, im using the build script
rollup -c && prettier -w public/build/bundle.css
with npm i -D prettier
all of this may be simpler when migrating from rollup
to vite
see also How do I disable minification when running "build" command in sveltekit?
and sveltejs: Switch existing project from rollup to vite
and awesome-vite
example vite.config.js
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({
// use relative paths to asset files
// https://github.com/vitejs/vite/issues/762
base: './',
plugins: [
svelte(),
],
build: {
// dont minify JS and CSS
minify: false,
rollupOptions: {
output: {
// remove hashes from output paths
// https://github.com/vitejs/vite/issues/378
entryFileNames: `assets/[name].js`,
chunkFileNames: `assets/[name].js`,
assetFileNames: `assets/[name].[ext]`
}
}
},
});
First of all, this question (or one similar) was asked here.
It seems that there isn't a way to do it based on that. I don't know what your exact use case for this is, but maybe you can run it through rollup-plugin-esformatter to make your code readable.
© 2022 - 2024 — McMap. All rights reserved.