How to use the @create-figma-plugin/common.constants.configFileName function in @create-figma-plugin/common

To help you get started, we’ve selected a few @create-figma-plugin/common 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 yuanqing / create-figma-plugin / packages / build / src / build-bundle.js View on Github external
export async function buildBundle (config, isDevelopment) {
  const entry = {}
  const commandEntryFile = await createCommandEntryFile(config)
  if (commandEntryFile !== null) {
    const key = extractBasename(constants.build.pluginCodeFilePath)
    entry[key] = commandEntryFile
  }
  const uiEntryFile = await createUiEntryFile(config)
  if (uiEntryFile !== null) {
    const key = extractBasename(constants.build.pluginUiFilePath)
    entry[key] = uiEntryFile
  }
  let webpackConfig = createWebpackConfig(entry, isDevelopment)
  const customWebpackConfigPath = await findUp(constants.configFileName)
  if (typeof customWebpackConfigPath !== 'undefined') {
    webpackConfig = require(customWebpackConfigPath)(webpackConfig)
  }
  return new Promise(function (resolve, reject) {
    webpack(webpackConfig, async function (error, stats) {
      if (stats.hasErrors() === true) {
        reject(stats.toJson().errors.join('\n'))
        return
      }
      if (error) {
        reject(error)
        return
      }
      resolve()
    })
  })