I am encountering some issues with webpack while working on an angular 6 project. When I run "node_modules.bin\webpack," I receive the following errors:
ERROR in ./src/app/template/header/header.component.ts Module not found: Error: Can't resolve 'src/app/services/authentication.service' in 'C:\GitHub\project-app\src\app\template\header' @ ./src/app/template/header/header.component.ts 13:0-80 55:41-62 @ ./src/app/app.module.ts @ ./src/main.ts
ERROR in ./src/app/template/header/header.component.ts Module not found: Error: Can't resolve 'src/app/services/local-storage.service' in 'C:\GitHub\project-app\src\app\template\header' @ ./src/app/template/header/header.component.ts 12:0-77 57:12-31 @ ./src/app/app.module.ts @ ./src/main.ts
ERROR in ./src/app/services/authentication.service.ts Module not found: Error: Can't resolve 'src/environments/environment' in 'C:\GitHub\project-app\src\app\services' @ ./src/app/services/authentication.service.ts 16:0-59 55:24-35 56:28-39 58:30-41 76:30-41 @ ./src/app/login/login.component.ts @ ./src/app/app.module.ts @ ./src/main.ts
I cannot determine why this issue is occurring. Building or running normally works fine. I tried creating a simple project, reconfiguring everything, and it worked without any problems, but for some reason, it does not work in this specific project.
//custom webpack configuration
var webpack = require('webpack');
const path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var ManifestPlugin = require('webpack-manifest-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
// more webpack config...
//tsconfig
{
"compileOnSave": false,
// additional TypeScript configurations...
}
//package jason
{
// package JSON data here...
}
//import statements in header component file
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { Router } from '@angular/router';
import { LocalStorageService } from 'src/app/services/local-storage.service';
import { AuthenticationService } from 'src/app/services/authentication.service';
// more code...