Skip to content

Commit

Permalink
chore: 🔧 improve rollup config, terser es module
Browse files Browse the repository at this point in the history
  • Loading branch information
Leecason committed Jun 2, 2020
1 parent 37016d1 commit 132d888
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,34 @@ import postcssPresetEnv from 'postcss-preset-env';
import typescript from 'rollup-plugin-typescript2';
import alias from '@rollup/plugin-alias';

const isProduction = process.env.BUILD === 'production';
const libDir = path.resolve(__dirname, 'lib');
const srcDir = path.resolve(__dirname, 'src');

export default () => [
getConfig({
optimize: true,
file: path.resolve(libDir, 'element-tiptap.min.js'),
format: 'umd',
esModule: true,
}),
getConfig({
optimize: true,
file: path.resolve(libDir, 'element-tiptap.common.js'),
format: 'cjs',
}),
getConfig({
file: path.resolve(libDir, 'element-tiptap.esm.js'),
format: 'es',
esModule: true,
}),
];

function getConfig ({
file,
format,
optimize,
esModule = false,
}) {
return {
input: path.resolve(srcDir, 'index.ts'),
output: {
file,
name: 'ElementTiptap',
format,
esModule,
globals: {
vue: 'Vue',
// TODO: tiptap
Expand Down Expand Up @@ -135,7 +127,7 @@ function getConfig ({
],
],
}),
optimize && isProduction && terser(),
terser(),
],
};
}

0 comments on commit 132d888

Please sign in to comment.