Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support file:// path in build options #236

Closed
narumincho opened this issue Dec 11, 2022 · 0 comments · Fixed by #242
Closed

support file:// path in build options #236

narumincho opened this issue Dec 11, 2022 · 0 comments · Fixed by #242
Labels
enhancement New feature or request

Comments

@narumincho
Copy link

import { build } from "https://deno.land/x/dnt@0.32.0/mod.ts";

await build({
  entryPoints: [import.meta.resolve("./main.ts")],
  outDir: import.meta.resolve("./dist/"),
  package: {
    name: "my-package",
    version: "1.0.0",
  },
  shims: {},
});

output

error: Uncaught (in promise) 'Module not found "file:///C:/Users/narum/Documents/GitHub/definy/deno-lib/file:/C:/Users/narum/Documents/GitHub/definy/deno-lib/main.ts".'

By using import.meta.resolve, you can specify a path relative from the file containing this script, whatever the current directory is.

This is the same as path.resolve(__dirname, 'dist') as often seen in webpack.config.js.

If it is difficult to distinguish between relative and absolute paths, you could use this behavior only when received as a URL

await build({
  entryPoints: [new URL(import.meta.resolve("./main.ts"))],
  outDir: new URL(import.meta.resolve("./dist/")),
  package: {
    name: "my-package",
    version: "1.0.0",
  },
  shims: {},
});
@dsherret dsherret added the enhancement New feature or request label Jan 9, 2023
@dsherret dsherret changed the title support file:// path? support file:// path in options? Jan 9, 2023
@dsherret dsherret changed the title support file:// path in options? support file:// path in build options Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants