83d8035dc2
* root + server * frontend * frontend-2 * dui3 * dui3 * tailwind theme * ui-components * preview service * viewer * viewer-sandbox * fileimport-service * webhook service * objectloader * shared * ui-components-nuxt * WIP full config * WIP full linter * eslint projectwide util * minor fix * removing redundant ci * clean up test errors * fixed prettier formatting * CI improvements * TSC lint fix * 'buildBatch' needs to be async since some batch types (like Text) require it. Removed a disabled liniting rule from ObjLoader * removed unnecessary void --------- Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
import { terser } from 'rollup-plugin-terser'
|
|
import clean from 'rollup-plugin-delete'
|
|
import pkg from './package.json'
|
|
import typescript2 from 'rollup-plugin-typescript2'
|
|
import { babel } from '@rollup/plugin-babel'
|
|
import { DEFAULT_EXTENSIONS } from '@babel/core'
|
|
import image from '@rollup/plugin-image'
|
|
|
|
const isProd = process.env.NODE_ENV === 'production'
|
|
const sourcemap = isProd ? false : 'inline'
|
|
|
|
/** @type {import('rollup').RollupOptions} */
|
|
const config = {
|
|
input: 'src/index.ts',
|
|
output: [
|
|
{
|
|
file: 'dist/index.js',
|
|
format: 'esm',
|
|
sourcemap
|
|
},
|
|
{
|
|
file: 'dist/index.cjs',
|
|
format: 'cjs',
|
|
sourcemap
|
|
}
|
|
],
|
|
plugins: [
|
|
clean({ targets: 'dist/*' }),
|
|
image(),
|
|
typescript2({
|
|
tsconfigOverride: {
|
|
sourceMap: sourcemap
|
|
},
|
|
tsconfig: './tsconfig.build.json'
|
|
}),
|
|
babel({
|
|
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
|
|
babelHelpers: 'bundled',
|
|
configFile: './.babelrc'
|
|
}),
|
|
...(isProd ? [terser()] : [])
|
|
],
|
|
// Externalizing all deps, we don't want to bundle them in cause this is a library
|
|
external: Object.keys(pkg.dependencies || {}).map((d) => new RegExp(`^${d}(\\/.*)?$`))
|
|
}
|
|
|
|
export default config
|