我正在尝试使用angular制作一个电子应用程序。
我遵循了教程 here。干净利落。但是我正在尝试使用本机节点模块,特别是“fs”
import { Injectable } from '@angular/core';
import * as fs from 'fs';
@Injectable()
export class FilesService {
constructor() { }
someMethod() {
return fs.lstat('./');
}
}在构建应用程序时,我得到了这个错误:ERROR in src/app/shared/files.service.ts(2,21): error TS2307: Cannot find module ‘fs’.
上网一段时间后,我发现它与angular cli生成的webpack配置有关,但我不知道如何更改这些配置……
发布于 2018-01-15 12:03:10
可能需要调整一下webpack的配置
externals应用于不捆绑nodejs端模块。https://stackoverflow.com/questions/48256245
复制相似问题