diff --git a/.eslintrc.json b/.eslintrc.json index b58f6b8e..40d711f0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,6 +17,8 @@ "example/typescript/type-check.js", "micromark/micromark.cjs", "micromark/micromark.dev.cjs", + "micromark/micromark-browser.js", + "micromark/micromark-browser.dev.js", "test-repos/" ], "overrides": [ diff --git a/.gitignore b/.gitignore index 1870076b..5300aba2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ demo/markdown-it.min.js demo/markdownlint-browser.min.js micromark/micromark.cjs micromark/micromark.dev.cjs +micromark/micromark-browser.js +micromark/micromark-browser.dev.js node_modules !test/node_modules npm-debug.log diff --git a/micromark/webpack.config.js b/micromark/webpack.config.js index 4acbdd98..22138fb9 100644 --- a/micromark/webpack.config.js +++ b/micromark/webpack.config.js @@ -2,33 +2,75 @@ "use strict"; -const shared = { +const base = { "entry": "./exports.mjs", "output": { + "path": __dirname + } +}; + +const commonjs = { + ...base, + "output": { + ...base.output, "library": { "type": "commonjs" - }, - "path": __dirname + } }, "target": "node" }; +const web = { + ...base, + "output": { + ...base.output, + "library": { + "type": "var" + } + }, + "target": "web" +}; + +const production = { + "mode": "production" +}; + +const development = { + "devtool": false, + "mode": "development" +}; + module.exports = [ { - ...shared, - "mode": "production", + ...commonjs, + ...production, "output": { - ...shared.output, + ...commonjs.output, "filename": "micromark.cjs" } }, { - ...shared, - "devtool": false, - "mode": "development", + ...commonjs, + ...development, "output": { - ...shared.output, + ...commonjs.output, "filename": "micromark.dev.cjs" } + }, + { + ...web, + ...production, + "output": { + ...commonjs.output, + "filename": "micromark-browser.js" + } + }, + { + ...web, + ...development, + "output": { + ...commonjs.output, + "filename": "micromark-browser.dev.js" + } } ];