remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

Doesn't inline JavaScript with type="module" #225

Open ashleydavis opened 2 years ago

ashleydavis commented 2 years ago

Not sure if this is a bug or intended operation, but Inline appears to ignore script tags with type="module", for example:

<script type="module" src="src.df4b993c.js"></script>

The output in the inlined file is lets the script tag pass through verbatim.

If I remove the type="module" then the JavaScript code is inlined correctly.

fsicre commented 2 years ago

Try this change

file js.js line 18

    if (type && type.toLowerCase() !== 'text/javascript') {
      debug('skipping %s', type);
      return false;
    }

PR #226

ashleydavis commented 2 years ago

@fsicre that works when I hack it into my local version of inliner.

Thanks, hope you PR gets accepted soon!

enk-it commented 1 month ago

Can confirm!