Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common.js 404 #47

Closed
ToniSoriano opened this issue Oct 11, 2019 · 10 comments
Closed

common.js 404 #47

ToniSoriano opened this issue Oct 11, 2019 · 10 comments

Comments

@ToniSoriano
Copy link

ToniSoriano commented Oct 11, 2019

After upgrading from 1.0.9 to the following, the application gives an error message. I'm using systemjs.config.js in my project to configure reference.

common.js 404.

Please help me.

@angelnikolov
Copy link
Owner

Hm, can you provide an absolutely minimal reproduction of the issue? I a current out on a Holiday but will check it out when I come back :)

@ToniSoriano
Copy link
Author

Until version 1.0.9 (included) everything works correctly, it is the last version that works for me.

In the systemjs.config.js I have the following reference:
map: {
'ngx-cacheable': 'npm: ngx-cacheable/dist'
},
packages: {
'ngx-cacheable': {
                 main: 'index.js', defaultExtension: 'js'
             }
}

In version 1.0.9 the "dist" folder has only one level. As of version 1.1.0 it already has more levels "dist", "dist/commons" and "dist/specs". As of version 1.2.0, the "dist" level disappears but the commons and specs folder exists.

I have tried with all versions and the error is always the same "GET https://localhost:44391/node_modules/ngx-cacheable/dist/common.js 404".

Take this opportunity to congratulate you on your library, it works great.

Enjoy holidays.

@angelnikolov
Copy link
Owner

angelnikolov commented Oct 16, 2019

Right, before I was wrongly publishing out of the root folder which actually deployed the source files too. So now, the lib is published out of dist/ itself.
Can you try changing the config in your system file to:

map: {
'ngx-cacheable': 'npm: ngx-cacheable'
},

@ToniSoriano

@ToniSoriano
Copy link
Author

I had already tried this, and with that configuration I still have the same error.
I have also tried to put the path in the tsconfig.js file. But, the result is the same.
"paths": {
"jszip": [
"node_modules/jszip/dist/jszip.min.js"
],
"ngx-cacheable": [ "node_modules/ngx-cacheable/index.js" ]
}

Capture

@angelnikolov
Copy link
Owner

@ToniSoriano Thanks for the screenshot. Unfortunately I can't reproduce this right now so if you could please create a stackblitz with this being reproduced, it will help immensely.

@ToniSoriano
Copy link
Author

Hi. I have found an alternative way to solve the problem.

It is about creating a common.js file in the root folder with the same code of the /common/index.js folder.

But it is not a good solution.

I write this in case it helps you to find the problem

Thanks.

@angelnikolov
Copy link
Owner

@ToniSoriano Can you test your issue with 1.4.0-beta.11. It is a version of ngx-cacheable which changes the module structure output to esm, cjs and es2015 modules.

@ToniSoriano
Copy link
Author

Thanks @angelnikolov.
I try with 1.4.0-beta.12 but in cjs have same problem, and the others protocols have a error TS¿?.
I will keep trying.

@ToniSoriano
Copy link
Author

ToniSoriano commented Jan 31, 2020

Hi again.

I'm solve this issue. The problem was in the definition of the systemjs.config.

Need define new entry in package for define path to common.js. I'm try this in version 1.4 and work fine.

Same this:

    map: {
        // our app is within the app folder
        app: 'app',

        'ngx-cacheable': 'npm:ngx-cacheable/cjs',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
        app: {
            defaultExtension: 'js'
        },
        'ngx-cacheable': {
            main: 'index.js', defaultExtension: 'js'
        },
        **'ngx-cacheable/common': {
            main: 'index.js', defaultExtension: 'js'
        }**
    }

Thanks for your attention.
Congratulations!!

@angelnikolov
Copy link
Owner

@ToniSoriano Glad you solved it :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants