Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sourcesContent only added to build options not transform options in JS API #682

Closed
jschaf opened this issue Jan 16, 2021 · 0 comments · Fixed by #683
Closed

sourcesContent only added to build options not transform options in JS API #682

jschaf opened this issue Jan 16, 2021 · 0 comments · Fixed by #683

Comments

@jschaf
Copy link
Contributor

jschaf commented Jan 16, 2021

The docs (https://esbuild.github.io/api/#sources-content) list sourcesContent as a valid option for both transform and build but the code for the JS API defines sourcesContent only for build flags:

let sourcesContent = getFlag(options, keys, 'sourcesContent', mustBeBoolean);

This means esbuild will error when you specify sourcesContent: false for the transform API:

  const esbuildOpts = {
    format: 'cjs',
    target: 'esnext',
    loader: loader,
    sourcemap: true,
    sourcesContent: false,
    sourcefile: sourcePath,
  };
  const result = esbuild.transformSync(sourceText, esbuildOpts);

Errors with:

Invalid option in transformSync() call: "sourcesContent"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant