rollup-plugin-minify-html-literals
rollup-plugin-minify-html-literals copied to clipboard
TypeError: minifyHTML is not a function
import minifyHTML from 'rollup-plugin-minify-html-literals';
const bundle = await rollup.rollup({
input: `${roots.js}/src/components/**/*.ts`,
output: {
file: out,
format: "es",
sourcemap: true
},
plugins: [
multi(),
resolve(),
minifyHTML(),
esbuild({
tsconfig: "./tsconfig.json",
minify: true,
}),
]
});
I'm not able to reproduce this, I assume this is a rollup.config.js file passed to rollup -c?
Can you add more details such as the error stack trace and what version of rollup/node you're using?
It's actually a part of my Gulp pipeline. Here, let me post the whole Gulp task:
"use strict";
import { pipeline } from "stream";
import gulp from "gulp";
import * as minifyHTML from 'rollup-plugin-minify-html-literals';
import * as rollup from "rollup";
import resolve from "@rollup/plugin-node-resolve";
import rollupTs from "@rollup/plugin-typescript";
import multi from "@rollup/plugin-multi-entry";
import esbuild from "rollup-plugin-esbuild";
// Component bundle
export const components = async () => pipeline(gulp.src(`${roots.js}/src/wcomps/**/*.ts`),
async () => {
const out = `${roots.js}/bundle/components.js`;
const bundle = await rollup.rollup({
input: `${roots.js}/src/wcomps/**/*.ts`,
output: {
file: out,
format: "es",
sourcemap: true
},
plugins: [
multi(),
resolve(),
minifyHTML(),
esbuild({
tsconfig: "./Ogma3/wwwroot/js/tsconfig.json",
minify: true,
}),
]
});
return bundle.write({
file: out,
format: "umd",
name: "components",
sourcemap: true
});
},
errorHandler);
For reference, I finally got it working with this package: https://github.com/jleeson/rollup-plugin-html-literals
I'm getting the same error as well.
I was getting the same issue using Vite. This worked for me:
import pkgMinifyHTML from 'rollup-plugin-minify-html-literals';
const minifyHTML = pkgMinifyHTML.default
That said it seriously breaks my app so it is a non-starter for me. I assume it is an issue with: https://www.npmjs.com/package/minify-html-literals
For me this works with rollup 2.79.1, but crashes with rollup 3.2.2. I use Node 14.19.0. Changelog at Rollup 3.0.0. (2022-10-11): Rollup now requires at least Node 14.18.0 to run (#4548 and #4596) https://github.com/rollup/rollup/blob/master/CHANGELOG.md
This started happening for me when I changed the package to the type of module and changed the rollup.config extension to mjs.
To get around it use minifyHTML.default();
I suspect this is because this package is not of type module.
Will this be investigated?