numical / script-ext-html-webpack-plugin

Enhances html-webpack-plugin functionality with different deployment options for your scripts including 'async', 'preload', 'prefetch', 'defer', 'module', custom attributes, and inlining.
MIT License
588 stars 105 forks source link

[Feature] Support .mjs file extension #58

Closed esrk closed 4 years ago

esrk commented 5 years ago

Request for .mjs file support.

For the following config, script is not injected into the html

Input:

plugins: [
  new HtmlWebpackPlugin({}),
  new ScriptExtHtmlWebpackPlugin({  module: ['bundle'] }),
],
output: {
  path: `${__dirname}/build`,
  filename: 'bundle.mjs',
}

Current Output:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Webpack App</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
  </head>
  <body></body>
</html>

Required Output:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Webpack App</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
  </head>
  <body>
    <script src="/bundle.js" type="module"></script>
  </body>
</html>

The same config works perfectly fine, if the bundled filename has .js extension.

parties commented 5 years ago

Try:

module: /.*bundle.*\.mjs$/
numical commented 4 years ago

Hello - I'm sorry to say that this plugin is no longer being maintained. I have tried to close all issues ahead of doing this but instead have found that the issue list just keeps growing. I simply do not have the time to keep up. Sorry. Please keep an eye on the README where I will record anyone who forks this repo with the intention to supporting it in the future.