Skip to content

docs(pluginutils): configure the correct options - #1563

Merged
shellscape merged 1 commit into
rollup:masterfrom
Plumbiu:master
Aug 26, 2023
Merged

docs(pluginutils): configure the correct options#1563
shellscape merged 1 commit into
rollup:masterfrom
Plumbiu:master

Conversation

@Plumbiu

@Plumbiu Plumbiu commented Aug 20, 2023

Copy link
Copy Markdown
Contributor

The dataToEsm API options example in the documentation is inconsistent with the output:

import { dataToEsm } from '@rollup/pluginutils';

const esModuleSource = dataToEsm(
  {
    custom: 'data',
    to: ['treeshake']
  },
  {
    compact: false,
    indent: '\t',
    preferConst: false,
    objectShorthand: false,
    namedExports: true
  }
);
/*
Outputs the string ES module source:
  export const custom = 'data';
  export const to = ['treeshake'];
  export default { custom, to };
*/

Rollup Plugin Name: {pluginutils}

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

Description

The right options should be:

const esModuleSource = dataToEsm(
  {
    custom: 'data',
    to: ['treeshake']
  },
  {
    compact: false,
    indent: '\t',
    preferConst: true,
    objectShorthand: true,
    namedExports: true
  }
);

@Plumbiu
Plumbiu requested a review from shellscape as a code owner August 20, 2023 15:34
@shellscape
shellscape merged commit 1ea9cc3 into rollup:master Aug 26, 2023
@shellscape

Copy link
Copy Markdown
Collaborator

thanks!

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 this pull request may close these issues.

3 participants