santi
santi11mo ago

Deno Jupyter Notebook - monorepo support

Hi all! We have a typescript-based monorepo that uses Turbo/Pnpm/etc Our primary reason for coming across Deno is that it seems to be the best supported way to use Typescript in a Jupyter notebook. We'd like set up a notebooks/ subfolder in the apps/* folder of the project and do queries there I haven't been able to set this up (maybe due to inexperience with Deno). For example, both of the following commands fail:
// Importing from a package in node_modules
import { PrismaClient } from '@prisma/client';
// Importing from a monorepo package
import { soemthing } from '@myapp/api';
// Importing from a package in node_modules
import { PrismaClient } from '@prisma/client';
// Importing from a monorepo package
import { soemthing } from '@myapp/api';
I've tried both in the root of the project and in the notebooks/* sub-folder
3 Replies
Deno AI Helper
Deno AI Helper11mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, there are a couple of things to note that might help you troubleshoot the issue. Firstly, Deno does not use the node_modules directory or the npm package manager. Instead, it imports modules using URLs or file paths. If you're trying to import from node_modules, that's not going to work in Deno. You would need to import modules from a URL or ensure that the module you're trying to import is compatible with Deno and structured in a way that Deno can understand. Secondly, there seems to be a typo in your import statement:
import { soemthing } from '@myapp/api';
import { soemthing } from '@myapp/api';
The word "something" is misspelled as "soemthing". This could be causing an import error if the correct export name is "something". Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If you're trying to work with a monorepo and use TypeScript in a Jupyter notebook with Deno, you may need to ensure that all your dependencies are Deno-compatible and that you're using the correct import paths.
ry
ry11mo ago
If you use the --unstable-byonm flag, I think you will get expected behavior https://docs.deno.com/runtime/manual/tools/unstable_flags#--unstable-byonm
dsherret
dsherret11mo ago
it can be added in a deno.json. I'd recommend enabling these unstable options to get it working as closely to node as possible:
{
"unstable": [
"bare-node-builtins",
"byonm",
"sloppy-imports",
"unsafe-proto"
]
}
{
"unstable": [
"bare-node-builtins",
"byonm",
"sloppy-imports",
"unsafe-proto"
]
}

Did you find this page helpful?