denoland / denoland/dnt

Broswer vs Node enviorment.

Open
#177 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
1.3k
Forks
49
PR merge metrics
No merged PRs in 30d

Description

I have a script that works in deno and node, but when I try and use it in a frontend project it is unable to resolve some of the differences between node and the browser.

Error
```
No matching export in "browser-external:buffer" for import "Blob"

node_modules/@about7sharks/get-articles/esm/_dnt.shims.js:3:9:
3 │ import { Blob } from "buffer";
```
Build script
```
import { build, emptyDir } from 'https://deno.land/x/dnt@0.26.0/mod.ts';
await emptyDir('./npm');

await build({
scriptModule: false,
entryPoints: ['./mod.ts'],
outDir: './npm',
compilerOptions: {
importHelpers: true,
target: "ES2021",
},
shims: {
blob: true,
crypto: true,
deno: true,
undici: true,
},
package: {
name: "@about7sharks/get-articles",
version: "0.0.40",
description: "A small library to get articles from Github",
license: "MIT",
dependencies: {
"gray-matter": "^4.0.3",
"marked": "^4",
},
devDependencies: {
"@types/node": "^16.7",
"@types/marked": "^4"
}
}

})
Deno.copyFileSync('README.md', './npm/README.md');
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.