小编Bra*_*ley的帖子

(webpack)/buildin/module.js 模块构建失败:错误:ENOENT:没有这样的文件或目录,

为了解决另一个仍未解决的问题(请参阅此处),我尝试将 webpack 4.15.x 添加到我的代码中。而不是想要的结果,它立即破坏了我的代码并给了我这个错误 (webpack)/buildin/module.js Module build failed: Error: ENOENT: no such file or directory and (webpack)/hot/emitter.js Module build失败:错误:ENOENT:没有这样的文件或目录。实际上,当我卸载并重新安装节点包时,还有另一个类似的错误得到解决。否则,我不知道如何继续。请指教。先感谢您。

webpack angular

4
推荐指数
1
解决办法
1万
查看次数

角度错误TS2304:找不到名称'config'

按照我在此处找到的教程,在Angular中重建演示登录和注册页面应用程序.目前得到这个

ERROR in src/app/_services/authentication.service.ts(10,35): error TS2304: Cannot find name 'config'
Run Code Online (Sandbox Code Playgroud)

在这里这里搜索类似的问题.第一个链接解决了webpack的问题但过时了,第二个链接完全不相关.我已经在tsconfig.app.json和tsconfig.spec.json中添加了"webpack-env".我还按照这些说明更新了webpack和webpack cli .

请参阅下面受影响的代码:webpack.config.js

const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './src/main.ts',
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: ['ts-loader', 'angular2-template-loader'],
        exclude: /node_modules/
      },
      {
        test: /\.(html|css)$/,
        loader: 'raw-loader'
      },
    ]
  },
  resolve: {
    extensions: ['.ts', '.js']
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
      filename: 'index.html',
      inject: 'body'
    }),
    new webpack.DefinePlugin({
      // global app config object
      config: …
Run Code Online (Sandbox Code Playgroud)

webpack angular

4
推荐指数
1
解决办法
4656
查看次数

错误参考错误:未定义配置

我正在构建一个带有登录和注册页面的基本应用程序(在 Angular 6 中)。我遵循了我在网上找到的登录/注册教程,但是由于某种原因,当我尝试登录时,我得到了

错误参考错误:未定义配置。

据我所知,我认为身份验证服务存在错误,因此会弄乱登录组件。我只是不确定为什么身份验证服务会给我带来问题。

请参阅下面的身份验证服务中的代码。

   import { Injectable } from '@angular/core';
   import { HttpClient } from '@angular/common/http';
   import { map } from 'rxjs/operators';

 @Injectable()
 export class AuthenticationService {
   constructor(private http: HttpClient) { }

   login(username: string, password: string) {
     return this.http.post<any>(`${config.apiUrl}/users/authenticate`, { 
     username: username, password: password })
       .pipe(map(user => {
    // login successful if there's a jwt token in the response
    if (user && user.token) {
      // store user details and jwt token in local storage to keep user …
Run Code Online (Sandbox Code Playgroud)

angular

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×3

webpack ×2