diff --git a/src/config/rollup.config.js b/src/config/rollup.config.js index 7e5b91b3..426582ef 100644 --- a/src/config/rollup.config.js +++ b/src/config/rollup.config.js @@ -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, diff --git a/src/utils.js b/src/utils.js index 973ce844..0f761e57 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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, '..') + } const modPkgPath = require.resolve(`${modName}/package.json`) const modPkgDir = path.dirname(modPkgPath) const {bin} = require(modPkgPath)