2023-01-14 15:05:04 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2023-06-23 03:36:07 +00:00
|
|
|
const webpack = require("webpack");
|
|
|
|
const TerserPlugin = require("terser-webpack-plugin");
|
|
|
|
const { name, version, homepage } = require("./package.json");
|
|
|
|
|
2023-05-27 18:03:20 -07:00
|
|
|
const htmlEntry = "./exports-html.mjs";
|
|
|
|
const htmlName = "micromarkHtmlBrowser";
|
|
|
|
|
2023-02-07 21:46:21 -08:00
|
|
|
const base = {
|
2023-01-14 15:05:04 -08:00
|
|
|
"entry": "./exports.mjs",
|
|
|
|
"output": {
|
2023-02-07 21:46:21 -08:00
|
|
|
"path": __dirname
|
2023-06-23 03:36:07 +00:00
|
|
|
},
|
|
|
|
"plugins": [
|
|
|
|
new webpack.BannerPlugin({
|
|
|
|
"banner": `${name} ${version} ${homepage}`
|
|
|
|
})
|
|
|
|
]
|
2023-02-07 21:46:21 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
const commonjs = {
|
|
|
|
...base,
|
|
|
|
"output": {
|
|
|
|
...base.output,
|
2023-01-14 15:05:04 -08:00
|
|
|
"library": {
|
|
|
|
"type": "commonjs"
|
2023-02-07 21:46:21 -08:00
|
|
|
}
|
2023-01-14 15:05:04 -08:00
|
|
|
},
|
|
|
|
"target": "node"
|
|
|
|
};
|
|
|
|
|
2023-02-07 21:46:21 -08:00
|
|
|
const web = {
|
|
|
|
...base,
|
|
|
|
"output": {
|
|
|
|
...base.output,
|
|
|
|
"library": {
|
2023-02-08 20:31:33 -08:00
|
|
|
"name": "micromarkBrowser",
|
2023-02-07 21:46:21 -08:00
|
|
|
"type": "var"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"target": "web"
|
|
|
|
};
|
|
|
|
|
|
|
|
const production = {
|
2023-06-23 03:36:07 +00:00
|
|
|
"mode": "production",
|
|
|
|
"optimization": {
|
|
|
|
"minimizer": [
|
|
|
|
new TerserPlugin({
|
|
|
|
"extractComments": false,
|
|
|
|
"terserOptions": {
|
|
|
|
"compress": {
|
|
|
|
"passes": 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
2023-02-07 21:46:21 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
const development = {
|
|
|
|
"devtool": false,
|
|
|
|
"mode": "development"
|
|
|
|
};
|
|
|
|
|
2023-01-14 15:05:04 -08:00
|
|
|
module.exports = [
|
|
|
|
{
|
2023-02-07 21:46:21 -08:00
|
|
|
...commonjs,
|
|
|
|
...production,
|
2023-01-14 15:05:04 -08:00
|
|
|
"output": {
|
2023-02-07 21:46:21 -08:00
|
|
|
...commonjs.output,
|
2023-01-14 15:35:52 -08:00
|
|
|
"filename": "micromark.cjs"
|
2023-01-14 15:05:04 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
2023-02-07 21:46:21 -08:00
|
|
|
...commonjs,
|
|
|
|
...development,
|
2023-01-14 15:05:04 -08:00
|
|
|
"output": {
|
2023-02-07 21:46:21 -08:00
|
|
|
...commonjs.output,
|
2023-01-14 15:35:52 -08:00
|
|
|
"filename": "micromark.dev.cjs"
|
2023-01-14 15:05:04 -08:00
|
|
|
}
|
2023-02-07 21:46:21 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
...web,
|
|
|
|
...production,
|
|
|
|
"output": {
|
2023-02-08 20:31:33 -08:00
|
|
|
...web.output,
|
2023-02-07 21:46:21 -08:00
|
|
|
"filename": "micromark-browser.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
...web,
|
|
|
|
...development,
|
|
|
|
"output": {
|
2023-02-08 20:31:33 -08:00
|
|
|
...web.output,
|
2023-02-07 21:46:21 -08:00
|
|
|
"filename": "micromark-browser.dev.js"
|
|
|
|
}
|
2023-05-27 18:03:20 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
...web,
|
|
|
|
...production,
|
|
|
|
"entry": htmlEntry,
|
|
|
|
"output": {
|
|
|
|
...web.output,
|
|
|
|
"library": {
|
|
|
|
...web.output.library,
|
|
|
|
"name": htmlName
|
|
|
|
},
|
|
|
|
"filename": "micromark-html-browser.js"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
...web,
|
|
|
|
...development,
|
|
|
|
"entry": htmlEntry,
|
|
|
|
"output": {
|
|
|
|
...web.output,
|
|
|
|
"library": {
|
|
|
|
...web.output.library,
|
|
|
|
"name": htmlName
|
|
|
|
},
|
|
|
|
"filename": "micromark-html-browser.dev.js"
|
|
|
|
}
|
2023-01-14 15:05:04 -08:00
|
|
|
}
|
|
|
|
];
|