-
Notifications
You must be signed in to change notification settings - Fork 104
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
Broken output (error in mkdirp() of createOutputWriter.js) #92
Comments
@Kronuz, any ideas here? |
Try |
@ztoben Fixed with |
@Trainmaster there are a few things to consider here: First, you seem to be using some configuration that ends up in webpack compiling things in it's memory filesystem (which is why you received Secondly, when that happens the now reverted patch from #90 is no longer putting the assets available in the memory file system, so webpack will no longer be able to properly open the assets file (for example to get the assets file from the running server, as it won't exist inside the virtual file system in memory) Finally, the error says "invalid argument" when passing the argument to I strongly suggest we dig deeper here, as of right now, the assets file is being written in the real file system, while the actual assets are not. |
@ztoben, What I'd do is reapply the pull request and normalize the path, making it absolute, by using var path = require("path");
...
var absolutePath = path.resolve(options.path);
fs.mkdirp(absolutePath, function (err) {
if (err) {
return next(error('Could not create output folder ' + absolutePath, err))
}
var outputPath = fs.join(absolutePath, options.filename)
...
} Maybe @Trainmaster could help verifying that fixes it. Edit: Apparently, paths should be absolute here, but they aren't, in this edit, I propose using |
@Kronuz, @Trainmaster: I've published a new alpha build with the changes suggested. Would you mind trying it out and seeing if it works for your setups? The version is |
We also need to check the internal memory filesystem content, to see if the assets are being created where they should. |
@Kronuz, I know you're probably busy but any chance you could get a PR in for that? This isn't exactly my forte. |
@ztoben It's not working with |
@Trainmaster, same error? If not could you post a stacktrace? |
I'll be working on resolving this in @ztoben, if you could post any additional information (stacktrace or whatever), that'd be very helpful. |
@Trainmaster, do you have
|
@ztoben, in this line here:
@Trainmaster, what is your actual webpack configuration? also, what Webpack version are you using? |
@Kronuz unfortunately I don't have a stacktrace as I'm unable to reproduce this issue. I was hoping @Trainmaster would be able to supply one. If you make any progress on this let me know. |
@ztoben, the thing is the problem is only there when Webpack, since v2.3.0, only accepts absolute paths in the configuration and default is also ends up being absolute, so we don't need to do that |
From the OP, he's using webpack My only guess would be that it's being caused by Edit: On top of that it looks like |
It'd be useful to have a minimal example which fails (one with just a couple files and a mini configuration to reproduce the issue). @Trainmaster, willing to help us with that? |
@ztoben, I created a gist with what we have, but this one is working fine... @Trainmaster, could you please check if anything else is missing so it fails? Edit: This is the Gist: https://gist.github.com/Kronuz/ac406b1b43bcca7d44622a2db50f853b |
@ztoben Sorry for the late reply. The stack trace with version
@Kronuz const webpack = require('webpack');
const path = require('path');
const AssetsPlugin = require('assets-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const includePaths = require('./webpack.includePaths');
module.exports = {
entry: {
app: './app.js',
},
output: {
filename: '[name]_[chunkhash].js',
publicPath: './js/',
},
module: {
rules: [
{
parser: {
amd: false,
},
},
{
test: /\.js$/,
loader: 'babel-loader',
include: includePaths,
},
{
test: /\.vue$/,
loader: 'vue-loader',
include: includePaths,
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader',
],
},
{
test: /\.scss$/,
use: [
{
loader: 'vue-style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'sass-loader',
},
],
},
{
test: require.resolve('js-cookie'),
use: [{
loader: 'expose-loader',
options: 'Cookies',
}],
},
{
test: require.resolve('moment'),
use: [{
loader: 'expose-loader',
options: 'moment',
}],
},
{
test: require.resolve('jquery'),
use: [{
loader: 'expose-loader',
options: 'jQuery',
}, {
loader: 'expose-loader',
options: '$',
}],
},
{
test: require.resolve('lodash'),
use: [{
loader: 'expose-loader',
options: '_',
}],
},
],
},
optimization: {
runtimeChunk: {
name: 'manifest',
},
splitChunks: {
chunks: 'initial',
cacheGroups: {
default: false,
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendor',
},
},
},
},
plugins: [
new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(de|fr|en|es|it|ja|tr|zh-cn)$/),
new webpack.NamedModulesPlugin(),
new webpack.NamedChunksPlugin((chunk) => {
if (chunk.name) {
return chunk.name;
}
return Array.from(chunk.modulesIterable)
.map(module => path.basename(module.request, '.js'))
.join('_');
}),
new AssetsPlugin(),
new VueLoaderPlugin(),
],
}; |
@Trainmaster, could you please check what’s missing from the Gist I published in my previous post, so it fails? I just can’t make it fail here. Are you running just |
@Kronuz I commented your Gist |
@ztoben, I know where the problem is coming from: assets-webpack-plugin/index.js Line 14 in 869563b
Path is hardcoded there, as "." , but it should come from compiler.options.output.path instead (at the time where the plugin is applied)
So that line above ( assets-webpack-plugin/index.js Line 29 in 869563b self.options.path = self.options.path || compiler.options.output.path; The thing is path must be absolute, and should default to the path from the compiler options output path. |
@Trainmaster, could you try 3.8.4-alpha.1 and let me know if it's fixed for you? Thanks! |
@ztoben It's working with |
As of version
3.6.1
there is an error thrown when using this plugin in a webpack configuration running a gulp task with the help ofwebpack-stream
. Here some information about my setup:And here the error:
The error isn't helpful at all, so I started debugging. First I enabled the
showStack
flag in/node_modules/plugin-error/index.js
. After that, the following stack trace is displayed:Then I stumbled upon #90. Those changes were introduced with
3.6.1
. So I tried the previous version3.6.0
which worked without throwing an error.In a next step I thought it would be useful to get some information about the data around the
mkdirp()
call. I added the following lineslib/output/createOutputWriter.js
.Using version
3.6.0
the following is displayed afterwards:But using version
3.6.1
the output is different:So do you have any idea how to fix this?
The text was updated successfully, but these errors were encountered: