path-browserify icon indicating copy to clipboard operation
path-browserify copied to clipboard

Use deno_std path module?

Open toyobayashi opened this issue 3 years ago • 0 comments

Would you mind switch to use deno_std's path module? API is compatible with Node.js, simply use deno bundle to output es module, make bundlers do tree shaking better

// mod.ts
import { win32, posix } from 'https://deno.land/[email protected]/path/mod.ts'

export { win32, posix }

export const {
  basename,
  delimiter,
  dirname,
  extname,
  format,
  fromFileUrl,
  isAbsolute,
  join,
  normalize,
  parse,
  relative,
  resolve,
  sep,
  toFileUrl,
  toNamespacedPath
} = posix
deno bundle mod.ts index.js
// package.json
{
  "module": "./index.js",
  "main": "./index.js",
  "type": "module"
}

toyobayashi avatar Nov 09 '22 08:11 toyobayashi