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

[Question] How to use inline function? #48

Closed wusatosi closed 4 years ago

wusatosi commented 6 years ago

Inline option is not working for me... Can anyone help me?

My web-pack version: 4.16.3 html-webpack-plugin version: 3.2.0

My webpack.config.js:

let path = require('path');
let HTMLWebpackPlugin = require('html-webpack-plugin');
let ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');

module.exports = {
    context: path.resolve(__dirname, 'src'),
    mode: 'development',
    entry: './app.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    plugins: [
        new HTMLWebpackPlugin({
            filename: 'index.html',
        }),
        new ScriptExtHtmlWebpackPlugin({
            inline: 'a.js'
        })
    ]
};

My app.js (entry) require('./a');

a.js (script I want to inline) console.log('yes');

Output html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Webpack App</title>
  </head>
  <body>
  <script type="text/javascript" src="bundle.js"></script></body>
</html>

Expect: a.js is inline to the output html as <script>console.log('yes');</script>

Which is: Not happening

matiastucci commented 6 years ago

I'm having the same problem. Did you resolve it?

coreykress commented 5 years ago

Same problem as well.

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.