JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 134012
  • Score
    100M100P100Q169219F
  • License MIT

A webpack plugin for converting external script files to inline script block. Requires 'html-webpack-plugin' to work.

Package Exports

  • html-inline-script-webpack-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-inline-script-webpack-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

HTML Inline Script Webpack Plugin for webpack (html-inline-script-webpack-plugin)

Latest version Download count Install size ci Package quality Language grade: JavaScript

NPM

A webpack plugin for converting external script files <script src="app.js"></script> to inline script block <script>...</script>. Requires html-webpack-plugin to work.

Inspired by react-dev-utils created by Facebook.

Install

Webpack5

NPM

npm i html-inline-script-webpack-plugin -D

Yarn

yarn add html-inline-script-webpack-plugin -D

Webpack4

NPM

npm i html-inline-script-webpack-plugin@^1 -D

Yarn

yarn add html-inline-script-webpack-plugin@^1 -D

Usage

By default, the plugin will convert all the external script files to inline script block.

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin(),
    new HtmlInlineScriptPlugin(),
  ]
}

To limit the scope of the plugin, specify lists of files you wish to convert in regular expressions:

const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin');

module.exports = {
  plugins: [
    new HtmlWebpackPlugin(),
    new HtmlInlineScriptPlugin([
      /runtime~.+[.]js$/,
      /app~.+[.]js$/
    ]),
  ]
}