diff --git a/rollup.utils.js b/rollup.utils.js index 634b82d1898c8521001712ad7cede796651de7bf..b3b2aa19971c785df9080a46180460cc2ac2a7d5 100644 --- a/rollup.utils.js +++ b/rollup.utils.js @@ -21,8 +21,15 @@ export function getBuildInfo(build) { export async function getPackagePath(packageName, assetPath) { const r = resolve(); - const id = (await r.resolveId(packageName)).id; - const packageInfo = r.getPackageInfoForId(id); - const fullAssetPath = path.join(packageInfo.root, assetPath); - return path.relative(process.cwd(), fullAssetPath); + const resolved = await r.resolveId(packageName); + let packageRoot; + if (resolved !== null) { + const id = (await r.resolveId(packageName)).id; + const packageInfo = r.getPackageInfoForId(id); + packageRoot = packageInfo.root; + } else { + // Non JS packages + packageRoot = path.dirname(require.resolve(packageName + '/package.json')); + } + return path.relative(process.cwd(), path.join(packageRoot, assetPath)); } \ No newline at end of file