Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

html-webpack-noscript-plugin

constgen9MIT1.0.0

Webpack plugin to add <noscript> to body

webpack, plugin, html, noscript

readme

html-webpack-noscript-plugin

NPM version NPM downloads NPM Package

Webpack Plugin that extends HtmlWebpackPlugin template with <noscript> tag with arbitrary HTML content inside

Installation

html-webpack-noscript-plugin can be installed using NPM. Inside your project, make sure html-webpack-plugin is a development dependency.

npm install --save-dev html-webpack-plugin html-webpack-noscript-plugin

Setup

This plugin should go after HtmlWebpackPlugin in the plugins config

webpack.config.js

let HtmlWebpackPlugin         = require('html-webpack-plugin')
let HtmlWebpackNoscriptPlugin = require('html-webpack-noscript-plugin')

const DISABLED_JAVASCRIPT_MESSAGE = `We're sorry but our app doesn't work properly <b>without JavaScript enabled</b>. Please enable it to continue.`

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

This will affect the compiled HTML file

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Webpack App</title>
  </head>
  <body>
    <noscript>We're sorry but our app doesn't work properly <b>without JavaScript enabled</b>. Please enable it to continue.</noscript>
    <script src="index_bundle.js"></script>
  </body>
</html>