Skip to content

Commit

Permalink
chore(rollup): clarify variables, add a 'global' comment (#2928)
Browse files Browse the repository at this point in the history
* chore(rollup): clarify the callback argument 'e' to 'entry'

* chore(rollup): clarify the callback argument 's' to 'str'

* chore(rollup): add global process
  • Loading branch information
sukvvon authored Jan 12, 2025
1 parent 592d6f8 commit fed314b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-undef */
/*global process*/
import path from 'path'
import alias from '@rollup/plugin-alias'
import babelPlugin from '@rollup/plugin-babel'
Expand Down Expand Up @@ -66,7 +66,7 @@ function createESMConfig(input, output, clientOnly) {
output: { file: output, format: 'esm' },
external,
plugins: [
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
alias({ entries: entries.filter((entry) => !entry.find.test(input)) }),
resolve({ extensions }),
replace({
...(output.endsWith('.js')
Expand All @@ -92,7 +92,7 @@ function createCommonJSConfig(input, output, clientOnly) {
output: { file: `${output}.js`, format: 'cjs' },
external,
plugins: [
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
alias({ entries: entries.filter((entry) => !entry.find.test(input)) }),
resolve({ extensions }),
replace({
'import.meta.env?.MODE': 'process.env.NODE_ENV',
Expand All @@ -108,7 +108,7 @@ function createCommonJSConfig(input, output, clientOnly) {
function createUMDConfig(input, output, env, clientOnly) {
let name = 'jotai'
const fileName = output.slice('dist/umd/'.length)
const capitalize = (s) => s.slice(0, 1).toUpperCase() + s.slice(1)
const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1)
if (fileName !== 'index') {
name += fileName.replace(/(\w+)\W*/g, (_, p) => capitalize(p))
}
Expand All @@ -129,7 +129,7 @@ function createUMDConfig(input, output, env, clientOnly) {
},
external,
plugins: [
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
alias({ entries: entries.filter((entry) => !entry.find.test(input)) }),
resolve({ extensions }),
replace({
'import.meta.env?.MODE': JSON.stringify(env),
Expand All @@ -152,7 +152,7 @@ function createSystemConfig(input, output, env, clientOnly) {
},
external,
plugins: [
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
alias({ entries: entries.filter((entry) => !entry.find.test(input)) }),
resolve({ extensions }),
replace({
'import.meta.env?.MODE': JSON.stringify(env),
Expand Down

0 comments on commit fed314b

Please sign in to comment.