Skip to content

Commit

Permalink
fix: rollup fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Jan 16, 2024
1 parent a9c9192 commit 3400882
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const replace = require('@rollup/plugin-replace')
const camelcase = require('lodash.camelcase')
const omit = require('lodash.omit')
const nodePolyfills = require('rollup-plugin-polyfill-node')
const {terser} = require('@rollup/plugin-terser')
const terser = require('@rollup/plugin-terser')
const {
pkg,
hasFile,
Expand Down
7 changes: 7 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ function resolveBin(modName, {executable = modName, cwd = process.cwd()} = {}) {
// ignore _error
}
try {
if (modName === 'rollup') {
// Rollup uses subpath exports without exporting package.json which is problematic
// Convert to absolute path first
const modPkgPathDist = require.resolve('rollup/dist/rollup.js')
const modPkgDirDist = path.dirname(modPkgPathDist)
modName = path.join(modPkgDirDist, '..')

Check warning on line 45 in src/utils.js

View check run for this annotation

Codecov / codecov/patch

src/utils.js#L43-L45

Added lines #L43 - L45 were not covered by tests
}
const modPkgPath = require.resolve(`${modName}/package.json`)
const modPkgDir = path.dirname(modPkgPath)
const {bin} = require(modPkgPath)
Expand Down

0 comments on commit 3400882

Please sign in to comment.