Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with webpack-manifest-plugin / in-memory files don't make it to disk #161

Open
nedtwigg opened this issue Aug 11, 2017 · 1 comment

Comments

@nedtwigg
Copy link

webpack-manifest-plugin is a super simple plugin that creates a manifest.json in the root directory that maps from entry points to their hashed contents.

With webpack-stream, the manifest.json file is never created. Using a hint from #147, I figured out the problem was that the plugin is writing to an in-memory filesystem that never gets written to disk.

This was the workaround that I hacked together:

path = require('path')
fs = require('fs')
...
gulp.src(config.siteSrc)
    .pipe(webpack({
      config : require('./webpack.config.js')
    }, webpackCore, (err, stats) => {
      // write the in-memory manifest to disk
      const abspath = path.resolve(config.siteRoot + '/manifest.json')
      const content = stats.compilation.compiler.outputFileSystem.readFileSync(abspath)
      fs.writeFileSync(abspath, content)
      cb(err)
    }))
    .pipe(gulp.dest(config.siteRoot))

This works, but it seems like one heck of a hack. Is this a bug in webpack-manifest-plugin? Is there something webpack-stream could do to make this workaround easier to find / unnecessary?

@LeonardMeagher2
Copy link

I imagine either webpack-manifest-plugin needs to add their file to the compilation.assets, OR webpack-stream needs to extract all files in it's memory-fs instance. I appreciate your hack though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants