2

I need to create a standalone HTML file (so no <script src="main.js"></script> tags.

I am using some node_modules and in development, writing it in separate files, but I want to be able to create a webpack.config.js that allows me to directly put the javascript into .html file. I know of HTMLWepackPlugin, but that only create a script tag that includes a source, not actually put the HTML in the file (even with inject: true).

Is there a workaround or another Wepack plugin?

1
  • 3
    html-webpack-inline-source-plugin. "This is an extension plugin for the webpack plugin html-webpack-plugin. It allows you to embed javascript and css source inline." Commented Jun 21, 2020 at 18:18

1 Answer 1

1

Webpack: How to inject javascript into the HTML instead of separate JS file

Use html-webpack-inline-source-plugin, it is an extension plugin for the html-webpack-plugin functionality by adding the {inlineSource: 'regex string'} option.

Git plugin link

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.