mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Replace browserify/uglify-js with webpack, shrink markdownlint-browser.js (fixes #362).
This commit is contained in:
parent
202b50060b
commit
369b0b5934
10 changed files with 844 additions and 3271 deletions
67
demo/webpack.config.js
Normal file
67
demo/webpack.config.js
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const webpack = require("webpack");
|
||||
|
||||
function config(options) {
|
||||
const { entry, filename, mode, packageJson } = options;
|
||||
const { name, version, homepage, license } = packageJson;
|
||||
return {
|
||||
"devtool": false,
|
||||
"entry": entry,
|
||||
"externals": {
|
||||
"markdown-it": "markdownit"
|
||||
},
|
||||
"mode": mode,
|
||||
"name": name,
|
||||
"output": {
|
||||
"filename": filename,
|
||||
"library": name.replace(/(-\w)/g, (m) => m.slice(1).toUpperCase()),
|
||||
"path": __dirname
|
||||
},
|
||||
"plugins": [
|
||||
new webpack.BannerPlugin({
|
||||
"banner": `${name} ${version} ${homepage} @license ${license}`
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.NODE_DEBUG": false
|
||||
})
|
||||
],
|
||||
"resolve": {
|
||||
"fallback": {
|
||||
"fs": false,
|
||||
"os": false,
|
||||
"path": false,
|
||||
"util": false
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
config({
|
||||
"entry": "../lib-es3/lib/markdownlint.js",
|
||||
"filename": "markdownlint-browser.js",
|
||||
"mode": "development",
|
||||
"packageJson": require("../package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/lib/markdownlint.js",
|
||||
"filename": "markdownlint-browser.min.js",
|
||||
"mode": "production",
|
||||
"packageJson": require("../package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/helpers/helpers.js",
|
||||
"filename": "markdownlint-rule-helpers-browser.js",
|
||||
"mode": "development",
|
||||
"packageJson": require("../helpers/package.json")
|
||||
}),
|
||||
config({
|
||||
"entry": "../lib-es3/helpers/helpers.js",
|
||||
"filename": "markdownlint-rule-helpers-browser.min.js",
|
||||
"mode": "production",
|
||||
"packageJson": require("../helpers/package.json")
|
||||
})
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue