mde / mde/ejs

Webpack problem with `node:` modules

Open
#805 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.1k
Forks
846
PR merge metrics
No merged PRs in 30d

Description

I am trying to build browser code, which uses ejs.

import ejs from "ejs";
...

Webpack throws error - "node: urls are not supported".
Ejs contains imports for "node:fs" and "node:path".

Is it possible to add browser exports to the package.json which will point to the ejs module with fs functionality removed?

Generally is should be two modules.
First - for browser, without fs.
Second - for node - if should extends browsed version with fs methods.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting package.json and the ejs imports of node:fs and node:path. Check how Webpack resolves the package for browser code and how the Node entry currently exposes fs functionality. Done means browser consumers can build without the node: URL error while Node consumers retain the existing fs-related behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.