nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Should support keepNames option for esbuild.

Open issue-up[bot] opened this issue 2 years ago • 0 comments

   Forwarded from downstream issue:

  • https://github.com/nuxt/framework/issues/5382 by @izure1

Environment

- Operating System: `Windows_NT`
- Node Version:     `v16.15.0`
- Nuxt Version:     `3.0.0-rc.3`
- Package Manager:  `[email protected]`
- Builder:          `vite`
- User Config:      `typescript`, `app`, `css`, `build`, `nitro`, `runtimeConfig`, `vite`
- Runtime Modules:  `-`
- Build Modules:    `-`

Reproduction

Describe the bug

I apologize for using a translator because of my poor English.

I checked that the class name was changed during the esbuild transform process during the nitro compiling. Some libraries use class names. In my case, it was the sequelize-typescript library.

A similar issue was mentioned in the esbuild repository. https://github.com/evanw/esbuild/issues/931

And I checked if the keepNames option is available in the nuxt.config file, but I couldn't find it.

Can I add an option within the esbuild function for the rollup plugin in the node_modules/nitropack/dist/chunks/prerender.mjs file?

  // node_modules/nitropack/dist/chunks/prerender.mjs:732
  return {
    name: "esbuild",
    async transform(code, id) {
      ...
      const result = await transform(code, {
        loader,
        target: options.target,
        define: options.define,
        sourcemap: options.sourceMap,
        sourcefile: id,
        keepNames: true // *Here
      });
      ...
    },

Additional context

No response

Logs

No response

issue-up[bot] avatar Jun 10 '22 15:06 issue-up[bot]