How to use the @rollup/pluginutils.dataToEsm function in @rollup/pluginutils

To help you get started, we’ve selected a few @rollup/pluginutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rollup / plugins / packages / json / src / index.js View on Github external
transform(json, id) {
      if (id.slice(-5) !== '.json' || !filter(id)) return null;

      return {
        code: dataToEsm(JSON.parse(json), {
          preferConst: options.preferConst,
          compact: options.compact,
          namedExports: options.namedExports,
          indent
        }),
        map: { mappings: '' }
      };
    }
  };

@rollup/pluginutils

A set of utility functions commonly used by Rollup plugins

MIT
Latest version published 29 days ago

Package Health Score

100 / 100
Full package analysis