Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: minifyHTML is not a function #24

Open
Atulin opened this issue May 15, 2022 · 7 comments
Open

TypeError: minifyHTML is not a function #24

Atulin opened this issue May 15, 2022 · 7 comments

Comments

@Atulin
Copy link

Atulin commented May 15, 2022

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,
		}),
	]
});
@asyncLiz
Copy link
Owner

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?

@Atulin
Copy link
Author

Atulin commented May 18, 2022

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

@PaulHMason
Copy link

I'm getting the same error as well.

@clibu
Copy link

clibu commented Jun 2, 2022

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

@tug-guenter
Copy link

tug-guenter commented Oct 17, 2022

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

@mjgchase
Copy link

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.

@motiejunas
Copy link

Will this be investigated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants