D
Deno

help

what’s the current best practice for bundling?

Ppixeleet11/13/2023
Is it deno esbuild? Wondering what supports npm specifiers and bundling atm
ABAltair 680b11/13/2023
I've built a small util using the above,. It is deno-installed. It uses a small cfg file that it builds when not found. A cfg-per-project. In any project just enter build on the command line. in /.vscode/dev.json/
{
"simple": {
"TargetFolder": "",
"Port": 80
},
"build": {
"Out": "dist",
"FileName": "kvValueCodec.js",
"Entry": [
"./src/mod.ts"
],
"Minify": false
}
}
{
"simple": {
"TargetFolder": "",
"Port": 80
},
"build": {
"Out": "dist",
"FileName": "kvValueCodec.js",
"Entry": [
"./src/mod.ts"
],
"Minify": false
}
}
I have many installed dev tools that use this cfg. I like to keep this in /.vscode folder. All my tools share this dev.json file. simple above is a small dev server that auto launches the browser. If you enter simple dist 8080 the above dev.json will be auto changed to:
"simple": {
"TargetFolder": "./dist",
"Port": 8080
},
"simple": {
"TargetFolder": "./dist",
"Port": 8080
},
so that any further use you will simply enter simple
DDoctor11/14/2023
// @deno-types="https://deno.land/x/esbuild@v0.17.19/mod.d.ts"
import { build, stop } from 'https://deno.land/x/esbuild@v0.17.19/mod.js'
import { denoPlugins } from 'https://deno.land/x/esbuild_deno_loader@0.7.0/mod.ts'

async function esbuild(inPath: string, outPath: string) {
const { errors, warnings } = await build({
plugins: denoPlugins(),
entryPoints: [ inPath ],
outfile: outPath,
format: 'esm',
bundle: true,
minify: true,
jsxFactory: 'x',
jsxFragment: 'y'
})
errors.forEach(error => console.error(error))
warnings.forEach(warning => console.warn(warning))
}
// @deno-types="https://deno.land/x/esbuild@v0.17.19/mod.d.ts"
import { build, stop } from 'https://deno.land/x/esbuild@v0.17.19/mod.js'
import { denoPlugins } from 'https://deno.land/x/esbuild_deno_loader@0.7.0/mod.ts'

async function esbuild(inPath: string, outPath: string) {
const { errors, warnings } = await build({
plugins: denoPlugins(),
entryPoints: [ inPath ],
outfile: outPath,
format: 'esm',
bundle: true,
minify: true,
jsxFactory: 'x',
jsxFragment: 'y'
})
errors.forEach(error => console.error(error))
warnings.forEach(warning => console.warn(warning))
}

Looking for more? Join the community!

Recommended Posts
How do I get a d.ts file to be used?I'm extending a type from `hono` by adding that code in a `hono.d.ts` file in my `src` folder. ```“Log streaming API” on Deno DeployWhat does “Log streaming API” refers to in the analytics section of the pricing page of Deno Deploy?Read-only FS detectionHi, I have few deps that by default create cache/log dirs... I can disable it, but the detection itsIs there a built-in parser for the string that Deno.inspect produces?I found out in another thread that Deno.inspect(myObj) produces a visually gorgeous string representHow to get the nice Deno console.log format into a string?When I do a console.log on an instantiated class object, I get a beautiful format in the terminal, tbyonm - force use of DenoWhen I use byonm enabled in my deno.json, and say I have a vite project triggered from a package.jsoCan I disable deno linting for individual files, or a path?I'm using VSCode and the Deno extension. I want to use the inbuilt functionality of VSCode for type Rust run JS/TSHow can I embed this project into a rust application so that rust can run js ts and has runtime api Set-Cookie - Header shows as "deleted"I am trying to use deno to script/scrape a website. I can successfully log in to the site (using fetI keep running into python download failed while trying to run 'cargo test' commandI am currently following the steps I. Deno's Contributing Guide and I am running cargo test but I kehow I can create an restful api with deno and firebase as database?how I can create an restful api with deno and firebase as database?How can I replace writeAllSync with the Streams API?How would one best refactor the following code to use the Web Streams API as suggested by the deprec