Closed tomwang1013 closed 7 years ago
It's working for me if I define filname as a path of output.
...
new ManifestPlugin({
fileName : path.join(__dirname, '..', 'rev-manifest.json'),
basePath : '/js/',
})
...
@btamas this didn't work for me. Say output.path
is public/assets
, the absolute path of my application is /home/wangxiantong/learning/mysite
, the result of your solution for me is:
which is terribly incorrect. Does basePath
matter? i didn't set basePath
I second this problem. I too am having issues with wanting to write to a specific directory.
Using a relative path as file name worked for me
new ManifestPlugin({
fileName : '../../manifest.json',
}),
but it feels very hacky and I agree that it should be its own configuration option.
btw, this got broken somewhere after 1.0.0
with version lower than 1.0.0
we had fileName: './rev-manifest-webpack.json',
and the file was placed to the folder in which webpack config is placed where with the latest version it gets placed in the dist
folder - where we do the webpack output
this is not good - I don't want my dist folder to have this file - it is not needed in dist
I agree with you, I think manifest.json
path should be relative to cwd
or context
That causing the issue, is this: https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L97-L104
I think it should be dropped, and the plugin should write to disk by himself, no rely on webpack to do it
I also believe that it will fix: #21
Thoughts?
@btamas 's solution should work for now
for v2
, it will use cwd as base directory
That causing the issue, is this: https://github.com/danethurber/webpack-manifest-plugin/blob/master/lib/plugin.js#L97-L104 I think it should be dropped, and the plugin should write to disk by himself, no rely on webpack to do it
@mastilver if we just drop these lines you reference we bring back other bugs, look at the description of the PR where those lines were added: https://github.com/danethurber/webpack-manifest-plugin/pull/6
So I guess it should be done with own configuration option
@zuzusik Can you check #56 for me, does it make sense?
@mastilver it looks like https://github.com/danethurber/webpack-manifest-plugin/pull/56 still doesn't give an ability to write file somewhere else rather than Webapck's output.path
without hacky approach described in https://github.com/danethurber/webpack-manifest-plugin/issues/33#issuecomment-302951171
So maybe it fixes #21 but looks like it still doesn't fix this particular issue
I know, I doing things step by step
v1
while for v2
we will change the way we handle fileName
I think it should be dropped, and the plugin should write to disk by himself, no rely on webpack to do it
so it's a step forward fixing this issue :)The best way to do it right now is to do it that way: https://github.com/danethurber/webpack-manifest-plugin/blob/master/spec/plugin.spec.js#L479
I will make sure it even works in the future
I'm closing this as the solution to this is to use an absolute path: fileName: path.join(__dirname, 'manifest.json')
Now the manifest.json is created under
output.path
which is set in webpack.config.js. But i want it to be in other directory.