You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m trying to make ESBuild generate entry points with a custom name (that doesn’t match the name of an entry point file). Until #553 or #518 are implemented, I’m trying to do that with a custom onResolve + onLoad ESBuild plugin.
The problem is that when I’m using the plugin to resolve an entry point, ESBuild escapes the entry point name. As a result, if I have an entry point called my-app.debug.js, and I resolve it to some custom code using a plugin, the generated bundle would be called my_app_debug.js.
This doesn’t happen when the resolution process doesn’t go through a plugin. So if my-app.debug.js actually existed on the file system, and the plugin wasn’t used, the bundle name would still be my-app.debug.js.
The build should generate a file called dist/virtual-entrypoint.debug.js. (This is what it would generate if virtual-entrypoint.debug.js was an actual entry point file present somewhere in the file system.)
Actual result
The build generates a file called dist/virtual_entrypoint_debug.js
The text was updated successfully, but these errors were encountered:
iamakulov
changed the title
Plugin-generated entrypoints have escaped names
Plugin-resolved entrypoints have their names escaped
Dec 9, 2020
The naming scheme for virtual modules is somewhat arbitrary because esbuild doesn't assume that a module's path is a file system path if it's not in the file namespace. Technically it's using the auto-generated "human-friendly identifier" for the virtual module which is why it's replacing non-identifier characters with _.
I can definitely derive virtual module paths differently. That shouldn't be too hard to change, and I don't see why not.
I’m trying to make ESBuild generate entry points with a custom name (that doesn’t match the name of an entry point file). Until #553 or #518 are implemented, I’m trying to do that with a custom
onResolve
+onLoad
ESBuild plugin.The problem is that when I’m using the plugin to resolve an entry point, ESBuild escapes the entry point name. As a result, if I have an entry point called
my-app.debug.js
, and I resolve it to some custom code using a plugin, the generated bundle would be calledmy_app_debug.js
.This doesn’t happen when the resolution process doesn’t go through a plugin. So if
my-app.debug.js
actually existed on the file system, and the plugin wasn’t used, the bundle name would still bemy-app.debug.js
.Steps to reproduce
yarn install
node esbuild.config.js
Expected result
The build should generate a file called
dist/virtual-entrypoint.debug.js
. (This is what it would generate ifvirtual-entrypoint.debug.js
was an actual entry point file present somewhere in the file system.)Actual result
The build generates a file called
dist/virtual_entrypoint_debug.js
The text was updated successfully, but these errors were encountered: