Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
create a separate types config
Browse files Browse the repository at this point in the history
  • Loading branch information
juliewongbandue committed Jul 13, 2023
1 parent d4f2a7e commit 6c3a1f9
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';

import pkg from './package.json';

Expand All @@ -13,7 +14,7 @@ export default (args) => {

/** @type {import('rollup').RollupOptions} */
let config = {
input: './src/!(_docs|_labs|_process|storybook)*/**/!(*.story.tsx|*.test.ts)',
input: './src/!(_docs|_labs|_process|storybook)*/**/!(*.story.tsx|*.test.ts|*.types.ts)',
output: [
{
dir: 'build',
Expand All @@ -30,5 +31,23 @@ export default (args) => {
plugins: [commonjs(), resolve(), typescript(), babel({ exclude: '**/node_modules', babelHelpers: 'runtime' }), multi()],
};

return config;
let typesConfig = {
input: './src/components/**/*.types.ts',
output: [
{
dir: 'build/types',
format: 'esm',
entryFileNames: '[name].esm.js',
},
{
dir: 'build/types',
format: 'commonjs',
entryFileNames: '[name].js',
},
],
external: Object.keys(pkg.peerDependencies),
plugins: [commonjs(), resolve(), typescript({ declarationDir: 'build/types', outDir: 'build/types' }), babel({ exclude: '**/node_modules', babelHelpers: 'runtime' }), multi()],
};

return [config, typesConfig];
};

0 comments on commit 6c3a1f9

Please # to comment.