Coder Social home page Coder Social logo

Comments (6)

bpevs avatar bpevs commented on May 17, 2024 1

FYI @jordandobrev it looks like this only happens with the deno global cache node_modules? As a workaround, I'm finding that this error seems to go away if using the nodeModulesDir: true. Not 100% if this is meant to be a public api or not, since it's not mentioned on the README, and it creates a node_modules dir in your project, but does seem to work. Probably portable works as well?

But for your example, this might work:

const result = await esbuild.build({
  plugins: [...denoPlugins({ nodeModulesDir: true })],
  entryPoints: [`${source}/handler.ts`],
  outfile: `${dist_folder}/handler-bundle.js`,
  bundle: true,
  format: "esm",
});

from esbuild_deno_loader.

adoublef avatar adoublef commented on May 17, 2024 1

@bpevs I just tried that fix with nodeModulesDir: true and seems to have helped my most recent issue

from esbuild_deno_loader.

cowboyd avatar cowboyd commented on May 17, 2024 1

Note that nodeModulesDir: true will not work on Deno Deploy https://github.com/lucacasonato/esbuild_deno_loader#limitations

from esbuild_deno_loader.

lucacasonato avatar lucacasonato commented on May 17, 2024 1

This should be fixed by #104

from esbuild_deno_loader.

bpevs avatar bpevs commented on May 17, 2024

I'm also seeing this behavior!

thrown from this line: https://github.com/lucacasonato/esbuild_deno_loader/blob/main/src/loader_native.ts#L161

import { build } from "npm:esbuild";
import { solidPlugin } from "npm:esbuild-plugin-solid";
import { denoPlugins } from "https://deno.land/x/[email protected]/mod.ts";
import { resolve } from 'https://deno.land/[email protected]/path/mod.ts';

const importMapURL = new URL('file://' + resolve('./import_map.json'))

const [denoResolver, denoLoader] = [...denoPlugins({ importMapURL })];
const result = await build({
    entryPoints: ["./source/index.tsx"],
    outfile: "./public/index.js",
    bundle: true,
    format: "esm",
    treeShaking: true,
    minify: true,
    plugins: [
        denoResolver,
        solidPlugin({ solid: { moduleName: 'npm:solid-js/web' } }),
        denoLoader
    ],
});
import { render } from "solid-js/web"
import { Motion } from "npm:@motionone/solid";

function App() {
  return <Motion>Hello world</Motion>
}

render(() => <App />, document.body)
...
✘ [ERROR] NPM package not found. [plugin deno-loader]

    ../../../../../../.deno/deno_esbuild/@solid-primitives/[email protected][email protected]/node_modules/@solid-primitives/refs/dist/index.js:1:35:
      1 │ import { chain, arrayEquals } from '@solid-primitives/utils';
...
error: Uncaught Error: Build failed with 17 errors:
...

from esbuild_deno_loader.

bpevs avatar bpevs commented on May 17, 2024

fix works for me on v0.8.4! Thanks!

from esbuild_deno_loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.