js-dxtools / webpack-validator

Validates your webpack config with Joi
MIT License
295 stars 29 forks source link

outputPath validation fails on Windows #139

Open mdurling opened 7 years ago

mdurling commented 7 years ago

webpack@2.1.0-beta.22 webpack-validator@2.2.9

The path check should be using the platform specific delimiter, e.g. require('path').sep

{ "metadata": { "port": 9000, "host": "localhost", "ENV": "development", "HMR": false }, "entry": { "app": [], "aurelia-bootstrap": [ "aurelia-bootstrapper-webpack", "aurelia-polyfills", "aurelia-pal", "aurelia-pal-browser", "regenerator-runtime", "bluebird" ], "aurelia": [ "aurelia-binding", "aurelia-dependency-injection", "aurelia-event-aggregator", "aurelia-framework", "aurelia-history", "aurelia-history-browser", "aurelia-loader", "aurelia-loader-webpack", "aurelia-logging", "aurelia-logging-console", "aurelia-metadata", "aurelia-path", "aurelia-route-recognizer", "aurelia-router", "aurelia-task-queue", "aurelia-templating", "aurelia-templating-binding", "aurelia-templating-router", "aurelia-templating-resources" ] }, "output": { "path": "C:\Git\proximus\dist\", "filename": "[name].bundle.js", "sourceMapFilename": "[name].bundle.map", "chunkFilename": "[id].chunk.js" }, "externals": { "jquery": "jQuery" }, "devServer": { "stats": { "colors": true, "hash": false, "version": true, "timings": false, "assets": true, "chunks": false, "modules": false, "reasons": false, "children": false, "source": false, "errors": true, "errorDetails": true, "warnings": true, "publicPath": false }, "port": 9000, "host": "localhost", "historyApiFallback": true, "watchOptions": { "aggregateTimeout": 300, "poll": 1000 }, "outputPath" [1]: "C:\Git\proximus\dist\" }, "debug": true, "devtool": "cheap-module-inline-source-map", "plugins": [ { "definitions": { "DEV": true, "ENV": "\"development\"", "HMR": false, "process.env": { "ENV": "\"development\"", "NODE_ENV": "\"development\"", "HMR": false, "WEBPACK_HOST": "\"localhost\"", "WEBPACK_PORT": "9000" } } } ] }

[1] "outputPath" should end with a slash (example: "/assets/" or "http://cdn.example.com/assets/[hash]/")

kentcdodds commented 7 years ago

I'm guessing the changes need to happen here: https://github.com/js-dxtools/webpack-validator/blob/master/src/types/absolutePath.js

Would you be willing to makeapullrequest.com?

nyrosmith commented 7 years ago

@kentcdodds This won't be an easy change bc the regex itself is not correct at all. I tried to change current query if it REALLY is an absolute path but afterwards lots of Test configs failed. Related issue: https://github.com/js-dxtools/webpack-validator/issues/131

If we change the current behavior we'd break lots of builds... But on the other side the validation is not correct right now.

kentcdodds commented 7 years ago

Sounds like we'd need a breaking change. Is there any reason we couldn't just use an existing npm package that does this check for us?

nyrosmith commented 7 years ago

No, but we'd have to change the Test configs to pass or just verify Test configs for the current platform. I am not sure if it is worth it because webpack2 has its own scheme validation.

kentcdodds commented 7 years ago

I am not sure if it is worth it because webpack2 has its own scheme validation.

Agreed. But this seems pretty significant for windows users. I'd be happy to accept a pull request that fixes it for that case. But I definitely don't have time to work on it myself.

mdurling commented 7 years ago

I think the change would be needed here https://github.com/js-dxtools/webpack-validator/blob/c9eea8d4142a329c09f0fd49ec0d411c4fe6ad4c/src/types/urlPart.js

However, I was using this package as a way to check configs that are failing the webpack2 validation which seems to be even more restrictive so yes, this package may become somewhat redundant for folks using webpack2.

kentcdodds commented 7 years ago

Sounds good. Anyone can feel free to make a PR to fix this issue. :+1: