Coder Social home page Coder Social logo

rollup-plugin-html-literals's People

Contributors

dgrammatiko avatar jleeson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rollup-plugin-html-literals's Issues

Rollup 4.x

Hi,
this plugin doesn't seems to be compliant with rollup 4.x.
Regards,
Cyrille.

Unable to use package with ESM rollup configuration

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.

Html-minifier high severity vulnerability

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.