generate-export.js 341 B

1234567891011121314
  1. const loaderDefaults = require('../config').loader;
  2. /**
  3. * @param {string} content
  4. * @param {boolean} [esModule=false]
  5. * @return {string}
  6. */
  7. function generateExport(content, esModule = loaderDefaults.esModule) {
  8. return esModule ?
  9. `export default ${content}` :
  10. `module.exports = ${content}`;
  11. }
  12. module.exports = generateExport;