Skip to content

Commit

Permalink
fix: remove addModuleExport option for cjs.
Browse files Browse the repository at this point in the history
  • Loading branch information
charkour committed Dec 9, 2023
1 parent c17d6c1 commit c68add1
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,13 @@ function createESMConfig(input, output) {
}
}

function createCommonJSConfig(input, output, options) {
function createCommonJSConfig(input, output) {
return {
input,
output: {
file: `${output}.js`,
format: 'cjs',
esModule: false,
outro: options.addModuleExport
? [
...Object.entries(options.addModuleExport).map(
([key, value]) => `module.exports.${key} = ${value};`,
),
].join('\n')
: '',
},
external,
plugins: [
Expand Down Expand Up @@ -174,17 +167,7 @@ module.exports = function (args) {
}
return [
...(c === 'index' ? [createDeclarationConfig(`src/${c}.ts`, 'dist')] : []),
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`, {
addModuleExport: {
index: {
create: 'create',
useStore: 'useStore',
createStore: 'vanilla.createStore',
},
vanilla: { createStore: 'createStore' },
shallow: { shallow: 'shallow$1' },
}[c],
}),
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`),
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.js`),
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`),
createUMDConfig(`src/${c}.ts`, `dist/umd/${c}`, 'development'),
Expand Down

0 comments on commit c68add1

Please sign in to comment.