Update to Angular v6 - Module not found: Error: Can't resolve 'fs'

前端 未结 12 2475
栀梦
栀梦 2020-11-30 06:04

I\'m trying to migrate my Angular Universal project from Angular v5 to v6

I\'ve got a service where I use fs to load the translation on the server side.

12条回答
  •  甜味超标
    2020-11-30 06:09

    Alternatively In NativeScript File is implemented as part of the file system module. To use it you have to import it in your code behind file. e.g.

    import * as fs from "file-system';
    
    var documents = fs.knownFolders.documents();
    var path = fs.path.join(documents.path, "FileFromPath.txt");
    var file = fs.File.fromPath(path);
    
    // Writing text to the file.
    file.writeText("Something")
        .then(function () {
            // Succeeded writing to the file.
        }, function (error) {
            // Failed to write to the file.
        });
    

提交回复
热议问题