1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/thoughtworks-taro-testing-library

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
configs.js 1.4 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
jiachen Отправлено 5 лет назад dc470b0
const path = require('path')
const typescript = require('rollup-plugin-typescript2')
const commonjs = require('rollup-plugin-commonjs')
const { uglify } = require('rollup-plugin-uglify')
const { terser } = require('rollup-plugin-terser')
const Nerv = require('nervjs')
const pkg = require('../package.json')
const resolve = _path => path.resolve(__dirname, '../', _path)
const configs = {
cjs: {
input: resolve('src/index.ts'),
file: pkg.main,
format: 'cjs',
env: 'production'
},
es: {
input: resolve('src/index.ts'),
file: pkg.module,
format: 'es',
env: 'production'
},
}
const compressPlugins = {
cjs: uglify,
es: terser
}
function genConfig (opts) {
const config = {
input: {
input: opts.input,
plugins: [
commonjs({
include: 'node_modules/**',
namedExports: {
nervjs: Object.keys(Nerv),
}
}),
typescript(),
],
external: [
'nervjs',
],
},
output: {
file: opts.file,
format: opts.format,
exports: 'named',
}
}
const method = compressPlugins[opts.format]
if ( opts.env === 'production' && method ) {
config.input.plugins.push(
method()
)
}
return config
}
function mapValues (obj, fn) {
const res = {}
Object.keys(obj).forEach(key => {
res[key] = fn(obj[key], key)
})
return res
}
module.exports = mapValues(configs, genConfig)

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/thoughtworks-taro-testing-library.git
git@gitlife.ru:oschina-mirror/thoughtworks-taro-testing-library.git
oschina-mirror
thoughtworks-taro-testing-library
thoughtworks-taro-testing-library
master