question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with main.js file

See original GitHub issue

Bug Report

Hi, i have problem with SSR on my project. When i run command

ng run project:server

It’s generating main.js file in ./dist/server folder but when i run command

webpack --config webpack.server.config.js --progress --colors

it causes this error:

ERROR in ./dist/server/main.js Module not found: Error: Can't resolve '.' in 'C:\Projects\my-project\dist\server' @ ./dist/server/main.js 81:17-29 @ ./server.ts.

Line that causes error: image. When i manually delete this line, webpack command runs correctly.

What modules are related to this issue?

- [ ] aspnetcore-engine
- [ ] common
- [x] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.0.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cdk                      6.4.0
@angular/cli                      6.0.8
@angular/material                 6.4.0
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.8.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
williamdescommented, Apr 23, 2020

Removing "outputHashing": "bundles", from my angular.json file did solve this issue. Or setting it to "outputHashing": "none",

                "server": {
                    "builder": "@angular-devkit/build-angular:server",
                    "options": {
                        "progress": false,
                        "outputPath": "dist/server",
                        "main": "server.ts",
                        "tsConfig": "src/tsconfig.server.json"
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ],
                            "optimization": true,
-                           "outputHashing": "bundles",
+                           "outputHashing": "none",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "vendorSourceMap": false
                        },
                        "staging": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.staging.ts"
                                }
                            ],
                            "optimization": true,
-                           "outputHashing": "bundles",
+                           "outputHashing": "none",
                            "sourceMap": false,
                            "namedChunks": false,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "vendorSourceMap": false
                        }
                    }
                },
0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2022

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Download Main.js and Fix Errors
main.js errors are related to problems that occur at AutoCAD runtime. Generally, JS errors are caused by missing or corrupt files.
Read more >
Error in console shows error in main.js on not specific file ...
I am working on a React project and I am trying to debug certain features. I've noticed when I get an error and...
Read more >
What went wrong? Troubleshooting JavaScript - MDN Web Docs
Generally speaking, when you do something wrong in code, there are two main types of error that you'll come across: Syntax errors: These...
Read more >
What Is Rna-main.js? How To Repair It? [SOLVED]
These rna-main.js problems are generally caused by Adobe Acrobat DC 2015-related file corruption, or in some cases, if the file has been accidentally...
Read more >
How to Solve the Chunk Load Error in JavaScript
This can occur when the checksum of the received file does not match the integrity attribute of the script tag. (For more information...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found