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

The requested module 'handlebars' does not provide an export named 'compile' #22484

Closed
sdankel opened this issue Feb 19, 2024 · 1 comment
Closed
Labels
invalid what appeared to be an issue with Deno wasn't

Comments

@sdankel
Copy link

sdankel commented Feb 19, 2024

Version: deno 1.40.3 (release, x86_64-apple-darwin)

Hello! I'm brand new to deno, so I'm not sure how to debug this any further.

Importing and using anything from npm:@fuel-ts/abi-typegen@0.73.0 causes this error. It works fine in node.

Minimal repro

// cli.ts
import { ProgramTypeEnum } from "npm:@fuel-ts/abi-typegen@0.73.0";
console.log("hello", ProgramTypeEnum.CONTRACT);
$ deno run cli.ts
error: Uncaught SyntaxError: The requested module 'handlebars' does not provide an export named 'compile'
    at <anonymous> (file:///<omitted>/Library/Caches/deno/npm/registry.npmjs.org/@fuel-ts/abi-typegen/0.73.0/dist/index.mjs:864:10)

When I look at the contents of <omitted>/Library/Caches/deno/npm/registry.npmjs.org/handlebars/4.7.8/types/index.d.ts, I can see that it exports the function compile.

I also tried deno run --unstable cli.ts to see if any of the unstable flags might help, but I get the same error.

@dsherret
Copy link
Member

That isn't a typescript error. It errors at runtime. I have the same thing happen in Node.js when importing from an mjs file:

> node main.mjs
file:///.../node_modules/@fuel-ts/abi-typegen/dist/index.mjs:864
import { compile } from "handlebars";
         ^^^^^^^
SyntaxError: Named export 'compile' not found. The requested module 'handlebars' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'handlebars';
const { compile } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7)
    at async handleMainPromise (node:internal/modules/run_main:113:12)

Node.js v20.11.1

I opened FuelLabs/fuels-ts#1776 in that package.

@dsherret dsherret added the invalid what appeared to be an issue with Deno wasn't label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid what appeared to be an issue with Deno wasn't
Projects
None yet
Development

No branches or pull requests

3 participants