Browse Source

Support ES Module output in npm package. #862

pull/863/head
Paul Irwin 3 years ago
parent
commit
3ebf37cc42
  1. 2
      package.json
  2. 56
      support/rollup.config.js

2
package.json

@ -12,10 +12,12 @@
"repository": "markdown-it/markdown-it",
"license": "MIT",
"main": "index.js",
"module": "dist/esm/markdown-it.mjs",
"bin": {
"markdown-it": "bin/markdown-it.js"
},
"scripts": {
"build": "rollup -c support/rollup.config.js",
"lint": "eslint .",
"test": "npm run lint && nyc mocha && node support/specsplit.js",
"coverage": "npm run test && nyc report --reporter html",

56
support/rollup.config.js

@ -5,6 +5,28 @@ import nodePolyfills from 'rollup-plugin-node-polyfills';
import pkg from '../package.json';
import { terser } from 'rollup-plugin-terser';
const unminifiedPlugins = [
// Here terser is used only to force ascii output
terser({
mangle: false,
compress: false,
format: {
comments: 'all',
beautify: true,
ascii_only: true,
indent_level: 2
}
})
];
const minifiedPlugins = [
terser({
format: {
ascii_only: true,
}
})
];
export default {
input: 'index.js',
output: [
@ -12,31 +34,25 @@ export default {
file: 'dist/markdown-it.js',
format: 'umd',
name: 'markdownit',
plugins: [
// Here terser is used only to force ascii output
terser({
mangle: false,
compress: false,
format: {
comments: 'all',
beautify: true,
ascii_only: true,
indent_level: 2
}
})
]
plugins: unminifiedPlugins,
},
{
file: 'dist/markdown-it.min.js',
format: 'umd',
name: 'markdownit',
plugins: [
terser({
format: {
ascii_only: true,
}
})
]
plugins: minifiedPlugins,
},
{
file: 'dist/esm/markdown-it.mjs',
format: 'es',
name: 'markdownit',
plugins: unminifiedPlugins,
},
{
file: 'dist/esm/markdown-it.min.mjs',
format: 'es',
name: 'markdownit',
plugins: minifiedPlugins,
}
],
plugins: [

Loading…
Cancel
Save