ACA library can't be built with dependency to ACA-shared

cancel
Showing results for 
Search instead for 
Did you mean: 
lhobza
Partner

ACA library can't be built with dependency to ACA-shared

Hello,
I have created my custom library in ACA project (I used this version of ACA: alfresco-content-app-1.11.0.zip) by following this tutorial:
https://alfresco-content-app.netlify.app/#/extending/redistributable-libraries
In my library I have created a component and in this component I have imported and used some stuff from alfresco/aca-shared library like this:

import { AppStoregetHeaderColor } from '@alfresco/aca-shared/store';
When I try to build my library with this import I get this error:
BUILD ERROR
Could not resolve entry (C:\PATH_TO_PROJECT\dist\my_custom_library\esm2015\my_custom_library.js)
Error: Could not resolve entry (C:\PATH_TO_PROJECT\dist\my_custom_library\esm2015\my_custom_library.js)
at error (C:\PATH_TO_PROJECT\node_modules\rollup\dist\rollup.js:3460:30)
at C:\PATH_TO_PROJECT\node_modules\rollup\dist\rollup.js:21474:17
at async Promise.all (index 0)

If I remove the import I am able to build the library normally. Am I doing something wrong? Do I need to do something else to  import the aca-shared library into my custom library?
4 Replies
dvuika
Alfresco Employee

Re: ACA library can't be built with dependency to ACA-shared

Can you please provide some example project to reproduce the issue? You can either link the .zip (without ".git" and "node_modules" folders) or create a github repo with that? Thanks.

lhobza
Partner

Re: ACA library can't be built with dependency to ACA-shared

When I try to reproduce it on a new project I get a different error: 
BUILD ERROR
Error during template compile of 'SharedStoreModule'
Function calls are not supported in decorators but 'EffectsModule' was called.

Here is the zip file with the clean aca 1.11.0 and custom extension which is giving me this error when I try to run this build script npm run build:my-extension
https://www.dropbox.com/s/nqijoc28yutas0g/alfresco-content-app-1.11.0.zip?dl=0

dvuika
Alfresco Employee

Re: ACA library can't be built with dependency to ACA-shared

I am able to reproduce this issue. We will try to fix it soon. 

khushbu
Active Member

Re: ACA library can't be built with dependency to ACA-shared

I was also facing the same issue in the ACA 1.11.0 version project while building my custom extension which was having an import statement "@alfresco/aca-shared/store".

In ACA 1.11.0 "aca-shared" is available as an extension project inside the "projects" folder of the main project instead of npm dependency registered in package.json file. Since it is an extension project so it was having an entry in the "path" object in "tsconfig.json" of the main project, as follows:

"@alfresco/aca-shared": [
"projects/aca-shared/src/public-api.ts"
],
"@alfresco/aca-shared/store": [
"projects/aca-shared/store/src/public-api.ts"
],
"@alfresco/aca-shared/rules": [
"projects/aca-shared/rules/src/public-api.ts"
],

From the custom extension, I'll not have access to the specified static path, so I have removed the above 3 entries & added the following 2 entries of the "@alfresco/aca-shared" as follows:

"@alfresco/aca-shared": [
    "dist/@alfresco/aca-shared"
],
"@alfresco/aca-shared/*": [
    "dist/@alfresco/aca-shared/*"
],

After the above change, I have tried to build my custom extension which was successfully built with the "@alfresco/aca-shared" import. I hope this maybe work in your case too.

Note: Since "@alfrescco/aca-shared" is an extension so must build it before building your extension so that inside dist it has the "@alfresco/aca-shared" folders with their respective built code ready to use in any extension project.