nginxbuildpolymerlit-html

Lit-html not found when using polymer build


I have a fairly basic lit-html app that works locally when it's not build. However when I build it using polymer build using the following config:

{
    "entrypoint": "index.html",
    "shell": "src/school-home.js",
    "sources": [
    "src/**.js",
    "package.json"
    ],
    "extraDependencies": [
    "node_modules/@webcomponents/webcomponentsjs/bundles/**"
    ],
    "builds": [
    {"preset": "es6-bundled"}
    ]
}

This results in a successful build but for some reason I keep getting an error:

enter image description here

I just don't get why it doesn't work. This like the basics of the basics yet it doesn't get found?

Aside: I use nginx for windows since I want to test E2E with my developed APIs.

An additional issue is that I keep getting CORS error for my API calls even though they are on the exact same location?!!

Please help.

Edit:

My NGINX config:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       cors-settings.conf;
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;


    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }

    server {
        listen       8000;
        server_name  localhost;    

    location /school {
        root /html/ing-school;
        try_files $uri $uri/ $uri.html /index.html;
    }   
    
    location ~ ^/(api|login|logout) {
        proxy_pass http://localhost:8080;
        proxy_set_header Connection "";

     if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain; charset=utf-8';
        add_header 'Content-Length' 0;
        return 204;
     }
     if ($request_method = 'POST') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
     }
    if ($request_method = 'GET') {
            add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-    With,If-Modified-Since,Cache-Control,Content-Type,Range';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-    Range';
     }
       }

        location /ws {
            proxy_pass http://127.0.0.1:8080;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

Solution

  • In case someone bumps into this, my issue was strangely due to the internal network I was on. I cannot provide proof anymore as the setup is completely different now.