Skip to content

Commit

Permalink
feat: add cjs module build
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Oct 9, 2020
1 parent 467b316 commit 6f4e360
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ npm install --save atom-ide-markdown-service
and use it inside your package like this:

```js
import { render } from "atom-ide-markdown-service/modules/renderer"
import { render } from "atom-ide-markdown-service/modules/renderer.es"
```

in which renderer is a function with this type `render(markdownText: string, grammar: string) => Promise<string>`
Expand All @@ -65,8 +65,7 @@ npm install --save atom-ide-markdown-service
and use it inside your package like this:

```js
const { provideMarkdownRenderer } = require("atom-ide-markdown-service")
const { render } = provideMarkdownRenderer()
const { render } = require("atom-ide-markdown-service/modules/renderer")
```

in which render is a function with this type `renderer(markdownText: string, grammar: string) => Promise<string>`
16 changes: 15 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,26 @@ export default [
external: ["atom"],
plugins: plugins,
},
// ES6 module
// ES6 module npm
{
input: "src/renderer.ts",
output: [
{
dir: "modules",
format: "cjs",
sourcemap: true,
},
],
// loaded externally
external: ["atom"],
plugins: plugins,
},
// csj npm
{
input: "src/renderer.ts",
output: [
{
file: "modules/renderer.es.js",
format: "es",
sourcemap: true,
},
Expand Down

0 comments on commit 6f4e360

Please sign in to comment.