Skip to content

Commit

Permalink
Fix tests 2
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed Mar 18, 2024
1 parent eb38796 commit 1cd791d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/registry/src/addon-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class AddonConfigurationRegistry {
}

this.projectRootPath = projectRootPath;
this.isVoltoProject = packageJson.name !== '@plone/volto';
this.voltoPath =
packageJson.name === '@plone/volto'
? `${projectRootPath}`
Expand Down
1 change: 1 addition & 0 deletions packages/volto/__tests__/webpack-relative-resolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe('WebpackRelativeResolver', () => {

it('handles "installed Volto" resolve requests', () => {
const registry = makeRegistry();
registry.isVoltoProject = true;
const resolver = new WebpackRelativeResolver(registry);
resolver.voltoPaths['@plone/volto/'] =
'/myvoltoproject/node_modules/@plone/volto/src';
Expand Down
8 changes: 3 additions & 5 deletions packages/volto/webpack-plugins/webpack-relative-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ class RelativeResolverPlugin {
this.source = source || 'resolve';
this.target = target || 'resolve';
this.registry = registry;
this.voltoModulePath = require
.resolve('@plone/volto')
.split('/')
.slice(0, -1)
.join('/');
this.voltoModulePath = registry.isVoltoProject
? require.resolve('@plone/volto').split('/').slice(0, -1).join('/')
: `${registry.voltoPath}/src`;
this.voltoPaths = Object.assign(
{ '@plone/volto/': this.voltoModulePath },
...Object.keys(registry.packages).map((k) => ({
Expand Down

0 comments on commit 1cd791d

Please sign in to comment.