Skip to content

Commit

Permalink
fix: umd export name (#3223)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepan662 authored Jul 27, 2023
1 parent 619a60f commit 2dad51e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
16 changes: 8 additions & 8 deletions packages/web/rollup.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ export const commonPlugins = [
* @param {string} ext
* @param {boolean} min
*/
const packageOutput = (name, format, ext, min) => {
const packageOutput = (name, env, format, ext, min) => {
const targets = [
{
name: `@tolgee/${name}`,
file: `dist/tolgee-${name}.${format}.${ext}`,
file: `dist/tolgee-${name}${env ? `.${env}` : ''}.${format}.${ext}`,
format,
sourcemap: true,
},
];
if (min) {
targets.push({
name: `@tolgee/${name}`,
file: `dist/tolgee-${name}.${format}.min.${ext}`,
file: `dist/tolgee-${name}${env ? `.${env}` : ''}.${format}.min.${ext}`,
format,
sourcemap: true,
plugins: [terser()],
Expand All @@ -73,14 +73,14 @@ const packageOutput = (name, format, ext, min) => {
return targets;
};

export const buildPackage = ({ input, name, min = true }) => ({
export const buildPackage = ({ input, name, env, min = true }) => ({
...commonConfig,
input,
output: [
...packageOutput(name, 'cjs', 'js', min),
...packageOutput(name, 'esm', 'js', min),
...packageOutput(name, 'esm', 'mjs', min),
...packageOutput(name, 'umd', 'js', min),
...packageOutput(name, env, 'cjs', 'js', min),
...packageOutput(name, env, 'esm', 'js', min),
...packageOutput(name, env, 'esm', 'mjs', min),
...packageOutput(name, env, 'umd', 'js', min),
],
plugins: commonPlugins,
});
6 changes: 4 additions & 2 deletions packages/web/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { buildPackage } from './rollup.common';
export default [
buildPackage({
input: 'src/entry-development.ts',
name: 'web.development',
name: 'web',
env: 'development',
}),
buildPackage({
input: 'src/entry-production.ts',
name: 'web.production',
name: 'web',
env: 'production',
}),

// in-context tools
Expand Down
3 changes: 2 additions & 1 deletion packages/web/rollup.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { buildPackage } from './rollup.common';
export default [
buildPackage({
input: 'src/entry-development.ts',
name: 'web.development',
name: 'web',
env: 'development',
min: false,
}),
];

0 comments on commit 2dad51e

Please sign in to comment.