Webpack problem with `node:` modules
Author: zdmCreated Apr 15, 2026Updated Apr 15, 2026
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.
Source: mde/ejs