webpack icon indicating copy to clipboard operation
webpack copied to clipboard

webpack doesn't run on Windows

Open jhnns opened this issue 13 years ago • 11 comments

Seems like the current implementation of webpack/lib/MemoryOutputFileSystem.js doesn't run on windows machines. It utilizes unix-style separators.

I've replaced all occurences with path.sep and uncommented the checks like this:

path = path.split(pathUtil.sep);
//if(path[0] != "") return callback(new Error("Invalid path " + path.join("/")));

and now it's running.

jhnns avatar Apr 26 '13 11:04 jhnns

How do you use it?

It works in memory and doesn't use system-dependend filenames (it doesn't access the disk). Use unix-like filenames.

If you use it with webpack-dev-middleware specify output.path = "/".

sokra avatar Apr 26 '13 14:04 sokra

I'm using webpack in conjunction with the webpack-dev-middleware. This is my current webpack configuration:

{
    alamidConfig: null,
    context: null,
    entry: "./app/init.client.js",
    output: {
        path: "assets",
        publicPath: "/assets/",
        filename: "app.[hash].js"
    },
    cache: true,
    amd: { jQuery: true },
    optimize: {
        minChunkSize: 10000,
        maxChunks: 20
    },
    debug: false,
    devtool: "eval",
    minimize : true,
    module: {
        loaders: [
            { test: /\.html$/i, loader: "raw-loader" }
        ]
    },
    resolve: {
        root: process.env.NODE_PATH
    },
    plugins: [
        new AlamidWebpackPlugin()
    ]
}

context and output.path are set on runtime depending on the alamid config. I tried a console.log to ensure that the paths are right:

context: C:\Users\jhnns\dev\peerigon
output.path: C:\Users\jhnns\dev\peerigon\bundle\assets

These paths do exist of course :wink:. The AlamidWebpackPlugin works as you suggested in #79. I've added console.logs to ensure that the plugin is not messing with the paths (especially replacing backslashes). And it seems like the plugin is working right.

Then I've added a console.log(path); on line 22 of MemoryOutputFileSystem.js and it prints:

C:\Users\jhnns\dev\peerigon\bundle\assets

After that it fails (of course).

jhnns avatar May 11 '13 14:05 jhnns

hmm... It's too complex to explain people why \ doesn't work with webpack-dev-middleware... So I'll add support for windows-like paths to the MemoryOutputFileSystem and MemoryInputFileSystem...

as workaround you just can set output.path to "/" (path is just in memory so it's irrelevant, but must be unix-like)

sokra avatar May 11 '13 16:05 sokra

You could also override output.path within the webpack-dev-middleware (as it is irrelevant).

jhnns avatar May 11 '13 17:05 jhnns

@jhnns overwriting of output.path would work currently, but supporting windows paths in the memory fs seem to be the cleaner solution.

sokra avatar May 12 '13 20:05 sokra

K thx. :smile:

jhnns avatar May 12 '13 21:05 jhnns

ridiculous. tried to use it. not working with windows? lol. hopefully this framework will be not succesful.

officechuber avatar Jan 16 '16 17:01 officechuber

@chrisiDC webpack is working on Windows. Check your configuration and stop flaming.

jhnns avatar Jan 16 '16 17:01 jhnns

with 20 years of experience i must be a complete fool not to be able to set it up within 4 hours.. have to quit my job. but sorry if i flame u. anyways, i dont think it works in windows out of the box... cheers

officechuber avatar Jan 17 '16 18:01 officechuber

I'm sorry. I used to have a Windows machine and I had no problems. Even @sokra, the owner of the project, has a Windows machine, so I bet webpack runs on Windows. Without any error or hint, we can't help you.

jhnns avatar Jan 18 '16 12:01 jhnns

i will provide an error hint asap. currently i am in the office :) thx for your feedback

officechuber avatar Jan 18 '16 12:01 officechuber