Skip to content

define of esbuild not work #4

@jianxinliu

Description

@jianxinliu

esbuild config:

const buildResult = await esbuild.build({
    entryPoints: ["./src/index.ts"],
    bundle: true,
    platform: "browser",
    outfile: outFilePath,
    minify: isProd,
    tsconfig: "./tsconfig.json",
    dropLabels: isProd ? ["DEV"] : [],
    drop: isProd ? ["console", "debugger"] : [],
    treeShaking: isProd,
    define: {
      "process.env.VERSION": `"${version}"`,
    },
    metafile: true,
    color: true,
    plugins: [
      ObfuscatorPlugin({
        filter: ['**/src/*.ts', '!**/node_modules/**'],
        shouldObfuscateOutput: false,
      }),
    ],
  });

define not work.

I only want to obfuscate the source code, not the dependencies loaded from node_modules. If set shouldObfuscateOutput = true, The substution on define does work, but it obfuscated all the code and produce a huge output file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions