Setup for using npm packages locally + via server.ts
Hi Deno,
I have a project in which I use Deno both to execute
This
which contains the following code to serve files:
and serves plain
I have this setup working for a long time, but it is a mess - I have installed
and I do this as a solution to have this javascript file working both locally (using deno run cli) and when accessing the file through the browser (using the server.ts above).
Is there a more cannonical approach to doing this? Key requirement is being able to use the same
I have a project in which I use Deno both to execute
ts/js files locally to compute features, using a command like:deno run --allow-all --v8-flags=--max-old-space-size=2192 compute.tsThis
compute.ts script uses .js scripts that are also used in a webpage I serve using a simple server.ts file, which I serve using deno:deno run -A server.tswhich contains the following code to serve files:
and serves plain
html, .js and .ttf files. I have this setup working for a long time, but it is a mess - I have installed
npm libraries using npm, access those javascript files by using direct paths:import * as FloBezier from "./node_modules/flo-bezier3/browser/index.js";and I do this as a solution to have this javascript file working both locally (using deno run cli) and when accessing the file through the browser (using the server.ts above).
Is there a more cannonical approach to doing this? Key requirement is being able to use the same
js file both locally and in the browser