Skip to content

Error when using alternative outputFileSystem (e.g. memory-fs) #3791

Open
@clemyan

Description

@clemyan

Version

3.5.5

Reproduction link

https://github.com/clemyan/vue-cli-fs-repro

Environment info

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
  Binaries:
    Node: 11.7.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.12.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    @vue/cli-overlay:  3.5.1
    @vue/cli-service: ^3.5.0 => 3.5.3
    @vue/cli-shared-utils:  3.5.1
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    vue: ^2.6.6 => 2.6.10
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

yarn build

What is expected?

Build finishes without error

What is actually happening?

An error is throw after assets are emitted. All assets are emitted properly.


The error is thrown from @vue\cli-service\lib\commands\build\formatStats.js while trying to print emitted assets info, because it attempts to read the emitted files from the real fs while the Webpack compiler could be using an outputFileSystem that does not write to real fs.

Since formatStats is already passed a Stats instance, in Webpack 4 it can avoid reading the fs by reading the emitted code from the stats object directly.

I have a use case in which I want to use webpack plugins to generate alternative assets (e.g. zip files) and avoid the cost of writing the app to the fs by using a custom outputFileSystem.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions