<commit_before>import fs from 'fs'
import path from 'path'
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import { camelCase } from 'lodash'
import { name, dependencies } from '../package.json'

const base = path.resolve(__dirname, '..')
const src = path.resolve(base, 'src')
const dist = path.resolve(base, 'dist')

const externals = ['vue', ...Object.keys(dependencies)]

// Libs in `external` will not be bundled to dist,
// since they are expected to be provided later.
// We want to include some of them in the build, so we exclude it here.
const externalExcludes = ['popper.js', 'vue-functional-data-merge']

// The base rollup configuration
const baseConfig = {
  input: path.resolve(src, 'index.js'),
  external: Object.keys(dependencies),
  plugins: [resolve({ external: ['vue'] }), commonjs(), babel({ exclude: 'node_modules/**' })]
}

// Ensure dist directory exists
if (!fs.existsSync(dist)) {
  fs.mkdirSync(dist)
}

export default [
  // UMD
  {
    ...baseConfig,
    external: externals.filter(dep => !externalExcludes.includes(dep)),
    output: {
      format: 'umd',
      name: camelCase(name),
      file: path.resolve(dist, `${name}.js`),
      sourcemap: true,
      globals: {
        vue: 'Vue'
      }
    }
  },

  // COMMON
  {
    ...baseConfig,
    external: externals.filter(dep => !externalExcludes.includes(dep)),
    output: {
      format: 'cjs',
      name: camelCase(name),
      file: path.resolve(dist, `${name}.common.js`),
      sourcemap: true
    }
  },

  // ES
  {
    ...baseConfig,
    output: {
      format: 'es',
      file: path.resolve(dist, `${name}.esm.js`),
      sourcemap: true
    }
  }
]
<commit_msg>chore(build): ensure Vue is excluded from `bootstrap-vue.esm.js` build (#3036)<commit_after>import fs from 'fs'
import path from 'path'
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import { camelCase } from 'lodash'
import { name, dependencies } from '../package.json'

const base = path.resolve(__dirname, '..')
const src = path.resolve(base, 'src')
const dist = path.resolve(base, 'dist')

const externals = ['vue', ...Object.keys(dependencies)]

// Libs in `external` will not be bundled to dist,
// since they are expected to be provided later.
// We want to include some of them in the build, so we exclude it here.
const externalExcludes = ['popper.js', 'vue-functional-data-merge']

// The base rollup configuration
const baseConfig = {
  input: path.resolve(src, 'index.js'),
  external: Object.keys(dependencies),
  plugins: [resolve({ external: ['vue'] }), commonjs(), babel({ exclude: 'node_modules/**' })]
}

// Ensure dist directory exists
if (!fs.existsSync(dist)) {
  fs.mkdirSync(dist)
}

export default [
  // UMD
  {
    ...baseConfig,
    external: externals.filter(dep => !externalExcludes.includes(dep)),
    output: {
      format: 'umd',
      name: camelCase(name),
      file: path.resolve(dist, `${name}.js`),
      sourcemap: true,
      globals: {
        vue: 'Vue'
      }
    }
  },

  // COMMON
  {
    ...baseConfig,
    external: externals.filter(dep => !externalExcludes.includes(dep)),
    output: {
      format: 'cjs',
      name: camelCase(name),
      file: path.resolve(dist, `${name}.common.js`),
      sourcemap: true
    }
  },

  // ES
  {
    ...baseConfig,
    external: ['vue'],
    output: {
      format: 'es',
      file: path.resolve(dist, `${name}.esm.js`),
      sourcemap: true
    }
  }
]

{'fraction_non_alphanumeric': 0.15940815187046342, 'fraction_numerical': 0.0011166945840312675, 'mean_word_length': 3.1089449541284404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067244', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1161, 'n_words': 312}