jleeson / rollup-plugin-html-literals Goto Github PK
View Code? Open in Web Editor NEWA Rollup plugin to minify html template literals
License: MIT License
A Rollup plugin to minify html template literals
License: MIT License
Hi,
this plugin doesn't seems to be compliant with rollup 4.x.
Regards,
Cyrille.
When trying to use this package with a rollup ESM configuration (npx rollup -c rollup.config.mjs) the import of the plugin seem to fail as the transpiled code in the npm package uses the legacy module.exports syntax.
The config I use in rollup.config.mjs is:
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import minifyHTML from 'rollup-plugin-minify-html-literals';
import commonjs from '@rollup/plugin-commonjs';
import litcss from 'rollup-plugin-lit-css';
const config = {
input: 'src/index.js',
output: {
file: 'dist/bundle.js',
format: 'esm',
sourcemap: false,
},
plugins: [
commonjs(),
minifyHTML(),
resolve(),
litcss(),
],
preserveEntrySignatures: true,
inlineDynamicImports: true,
};
if (process.env.NODE_ENV !== 'development') {
config.plugins.push(terser());
}
export default config;
The crash I get is:
$ npx rollup -c rollup.config.mjs
[!] TypeError: minifyHTML is not a function
TypeError: minifyHTML is not a function
at file:///home/user/project/rollup.config.mjs:16:5
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at ESMLoader.import (node:internal/modules/esm/loader:331:24)
at importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at loadConfigFile (/home/user/project/node_modules/rollup/dist/shared/loadConfigFile.js:514:16)
at Object.loadAndParseConfigFile (/home/user/project/node_modules/rollup/dist/shared/loadConfigFile.js:491:21)
at getConfigs (/home/user/project/node_modules/rollup/dist/bin/rollup:1753:39)
at runRollup (/home/user/project/node_modules/rollup/dist/bin/rollup:1727:43)
As the source code in this repo is already using modern ESM syntax, is this possible to change in the build config for this package to ease the usage?
In case it is related to how the minify-html-literals repo builds their code, I created an issue there as well asyncLiz/minify-html-literals#40.
The reason why it needs to be ESM is that there are other ESM rollup plugins needed in the project I work with.
I will report it on minify-html-literals repository, please delete this
html-minifier *
Severity: high
kangax html-minifier REDoS vulnerability - GHSA-pfq8-rq6v-vf5m
No fix available
node_modules/html-minifier
minify-html-literals *
Depends on vulnerable versions of html-minifier
node_modules/minify-html-literals
rollup-plugin-html-literals *
Depends on vulnerable versions of minify-html-literals
node_modules/rollup-plugin-html-literals
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.