|
|
@@ -393,7 +393,10 @@ function getWebpackConfig( snippets, config ) {
|
|
|
// Configure the paths so building CKEditor 5 snippets work even if the script
|
|
|
// is triggered from a directory outside ckeditor5 (e.g. multi-project case).
|
|
|
resolve: {
|
|
|
- modules: getModuleResolvePaths()
|
|
|
+ modules: [
|
|
|
+ ...getPackageDependenciesPaths(),
|
|
|
+ ...getModuleResolvePaths()
|
|
|
+ ]
|
|
|
},
|
|
|
|
|
|
resolveLoader: {
|
|
|
@@ -471,6 +474,21 @@ function getModuleResolvePaths() {
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Returns an array that contains paths to packages' dependencies.
|
|
|
+ * The snippet adapter should use packages' dependencies instead of the documentation builder dependencies.
|
|
|
+ *
|
|
|
+ * See #7916.
|
|
|
+ *
|
|
|
+ * @returns {Array.<String>}
|
|
|
+ */
|
|
|
+function getPackageDependenciesPaths() {
|
|
|
+ const packagesDirectory = path.resolve( __dirname, '..', '..', 'packages' );
|
|
|
+
|
|
|
+ return fs.readdirSync( packagesDirectory )
|
|
|
+ .map( directory => path.join( packagesDirectory, directory, 'node_modules' ) );
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Reads the snippet's configuration.
|
|
|
*
|