JSPM

@serguun42/webpack-userscript-plugin

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q39606F
  • License BSL-1.0

A plugin used build userscripts with Webpack

Package Exports

  • @serguun42/webpack-userscript-plugin
  • @serguun42/webpack-userscript-plugin/index.js

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 (@serguun42/webpack-userscript-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Webpack Userscript Plugin

Appends generated script with Userscript metadata. Continuation of serguun42-webpack-userscript which itself was a fork of webpack-userscript package by MomoCow. Supports webpack of versions 4+ and 5+.

Usage

Suitable for webpack v4 and webpack v5. From package.json:

"peerDependencies": {
  "webpack": "^4.0.0 || ^5.0.0"
}
  1. Install – npm i @serguun42/webpack-userscript-plugin.
  2. Add to webpack config's plugins section (usually webpack.config.js):
const WebpackUserscriptPlugin = require("@serguun42/webpack-userscript-plugin");

module.exports = {
  entry: "…",
  output: {
    path: "…",
    filename: "…",
  },plugins: [,
    new WebpackUserscriptPlugin(pluginOption),]
}

Config/params

Add plugin with constructor:

new WebpackUserscriptPlugin(pluginOption);

Where pluginOption is object of type WebpackUserscriptPluginOptions with following props:

name description/type default
headers string for location of .json file with headers or object with metadata fields (of type UserscriptMetadata) required
pretty Prettify headers with even space or not true
metajs Create additional .meta.js file (in the same output directory) with headers only false

See also


BSL-1.0 License