Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
Update rollup.config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
quisido committed May 9, 2021
1 parent 04a0ca5 commit 70d57b4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import postcss from 'rollup-plugin-postcss';
import typescript2 from 'rollup-plugin-typescript2';
import packageJson from './package.json';

const COMMONJS_EXTENSION = 'cjs';
const ESM_EXTENSION = 'js';
const IS_DEV = process.env.NODE_ENV === 'development';
const MAIN_DIR = path.parse(packageJson.main).dir;
const MODULE_DIR = path.parse(packageJson.module).dir;
Expand Down Expand Up @@ -38,17 +40,17 @@ export default [
},
output: [
{
chunkFileNames: '[name]-[hash].cjs',
chunkFileNames: `[name]-[hash].${COMMONJS_EXTENSION}`,
dir: MAIN_DIR,
entryFileNames: '[name].cjs',
entryFileNames: `[name].${COMMONJS_EXTENSION}`,
exports: 'named',
format: 'cjs',
sourcemap: IS_DEV,
},
{
chunkFileNames: '[name]-[hash].mjs',
chunkFileNames: `[name]-[hash].${ESM_EXTENSION}`,
dir: MODULE_DIR,
entryFileNames: '[name].mjs',
entryFileNames: `[name].${ESM_EXTENSION}`,
format: 'es',
sourcemap: IS_DEV,
},
Expand Down

0 comments on commit 70d57b4

Please sign in to comment.