Comments (3)
@codesculpture, @itsdouges and I are looking into this problem
from esbuild_deno_loader.
I made a plugin to rewrite npm:...
to esm.sh
before deno plugin like this:
await esbuild.build({
plugins: [
// ESBuild plugin to rewrite import starting "npm:" to "esm.sh" for https plugin
{
name: "the-npm-plugin",
setup(build: any) {
build.onResolve({ filter: /^npm:/ }, (args: any) => {
return {
path: args.path.replace(/^npm:/, "//esm.sh/"),
namespace: "https",
};
});
},
},
denoPlugin() as any,
],
However it doesn't utilize the cache, it seems to be downloading all of the files I rewrite like that on each build.
Also it seems to be that tree shaking doesn't work for those imports (currently I use it to just date-fns) which is a bummer.
But it works for the time being.
Edit I also noticed I can get it to work like this:
import_map.json
{
"imports": {
"npm:date-fns": "https://esm.sh/date-fns"
}
}
denoPlugin({
importMapURL: new URL("./import_map.json", import.meta.url),
}) as any,
Problem with this approach is the same as with my plugin above, the esbuild command re-downloads the URLs each time. In my example it re-downloads https://esm.sh/date-fns
on each build and it makes it slow.
from esbuild_deno_loader.
Is there any work being done on this at the moment?
from esbuild_deno_loader.
Related Issues (20)
- [ERROR] Directory not empty (os error 39) on build in docker HOT 2
- imports map not working HOT 2
- [plugin deno-loader] Module not found - preact/hook HOT 1
- Using with Deno Deploy HOT 2
- Relative path are not loaded HOT 1
- Module parse failure make the file unwatchable
- Document minimum deno version this works with HOT 1
- npm deps, with dependencies on node libraries are not handled properly HOT 1
- importmap support local path HOT 3
- [ERROR] File name too long HOT 2
- Bug: Failing to treeshake dead imports of sub files that have node type imports in them HOT 2
- Error when importing JSR packages with jsr specifiers: "Importing a JSR package via an HTTPS URL is not implemented."
- Allow Remote Config File
- Top-level await is disallowed in service workers. HOT 2
- Could not resolve react in "@react-three/drei" using deno-loader
- Loader doesn't work with esbuild's stdio option HOT 3
- Preact support
- Unable to build with `npm:*` dependencies HOT 2
- Read permission is always required even with the portable loader
- Plugin breaks non-JS/TS code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esbuild_deno_loader.