Skip to content

Commit 495df9d

Browse files
committed
Fail build on deep requires in npm packages
1 parent 2c9d8ef commit 495df9d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

scripts/rollup/build.js

+11
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,17 @@ async function createBundle(bundle, bundleType) {
582582
const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/');
583583
const isProvidedByDependency = externals.some(containsThisModule);
584584
if (!shouldBundleDependencies && isProvidedByDependency) {
585+
if (id.indexOf('/src/') !== -1) {
586+
throw Error(
587+
'You are trying to import ' +
588+
id +
589+
' but ' +
590+
externals.find(containsThisModule) +
591+
' is one of npm dependencies, ' +
592+
'so it will not contain that source file. You probably want ' +
593+
'to create a new bundle entry point for it instead.'
594+
);
595+
}
585596
return true;
586597
}
587598
return !!peerGlobals[id];

0 commit comments

Comments
 (0)