Open bartekus opened 8 years ago
Can you provide some more infos? Are you using the latest Version? What does your webpack-config look like? Can you show the code how you call webpack-validator?
My guess is that webpack-config
is adding DEPENDENCY_TREE
to your config. That's not a property that webpack utilizes AFAIK. So you'll want to extend the default schema to allow for the extra property. Read more here.
Indeed, it does look like webpack-config add's "DEPENDENCY_TREE" to the config, however I'm still not able to get past [1] "DEPENDENCY_TREE" is not allowed.
my current attempt to wrap the whole config at the root:
'use strict'; // eslint-disable-line strict
const WebpackConfig = require('webpack-config');
const validate = require('webpack-validator');
const Joi = require('webpack-validator').Joi;
const environment = WebpackConfig.environment;
const BaseConfig = new WebpackConfig.Config();
environment.setAll({
env: () => process.env.NODE_ENV
});
const entryWebpackConfig = BaseConfig.extend('config/webpack/webpack.config.[env].js');
// This joi schema will be `Joi.concat`-ed with the internal schema
const webpackValidatorExtension = Joi.object({
// this would just allow the property and doesn't perform any additional validation
DEPENDENCY_TREE: Joi.any(),
});
module.exports = validate(entryWebpackConfig, { schemaExtension: webpackValidatorExtension });
So with that the other rendition of "DEPENDENCY_TREE" are gone, but one still prevails :( Where am I going wrong?
ping @jonathanewerner who set this up. I'm not sure how to work around this issue.
So with that the other rendition of "DEPENDENCY_TREE" are gone, but one still prevails :( Where am I going wrong?
So there are two instances of the key DEPENDENCY_TREE
in the resulting config object?
Could you post the whole entryWebpackConfig
object, plus the whole console output of webpack-validator?
Sorry for the delay, I should have provided these to begin with, but no matter. Webpack-Config + Webpack Validation
Thank you gentlemen for your kind assistance in this matter!
Could you post the whole
entryWebpackConfig
object, plus the whole console output of webpack-validator?
Your gist neither shows the resulting object nor the exact console output. :) Could you maybe copy&paste the output from console.log
/JSON.stringify
-ing the entryWebpackConfig
object; plus the output that webpack-validator provides?
> whr3k@0.0.21 validate /Users/Bart/Dev/wh3rk
> npm-run-all --parallel validate:*
> whr3k@0.0.21 validate:dev /Users/Bart/Dev/wh3rk
> NODE_ENV=development webpack-validator webpack.config.js
> whr3k@0.0.21 validate:prod /Users/Bart/Dev/wh3rk
> NODE_ENV=production webpack-validator webpack.config.js
> whr3k@0.0.21 validate:test /Users/Bart/Dev/wh3rk
> NODE_ENV=test webpack-validator webpack.config.js
Reading: webpack.config.js
Reading: webpack.config.js
Reading: webpack.config.js
wh3rk:test Extending webpack configuration with test settings. +0ms
wh3rk:dev Extending webpack configuration with development settings: +0ms
wh3rk:prod Extending webpack configuration with production settings: +0ms
wh3rk:test ... +2ms
wh3rk:dev Adding HMR entry points +2ms
wh3rk:prod Applying ExtractTextPlugin to CSS loaders. +2ms
wh3rk:dev Enable HMR development plugin +1ms
wh3rk:test ... +1ms
wh3rk:prod Adding ExtractText UglifyJs and Dedupe plugins +2ms
wh3rk:boot Creating webpack configuration... +701ms
wh3rk:boot Creating webpack configuration... +700ms
wh3rk:boot Creating webpack configuration... +701ms
{
"context": "/Users/Bart/Dev/wh3rk/src",
"entry": {
"app": [
"/Users/Bart/Dev/wh3rk/src/client.js"
],
"vendor": [
"react",
"react-redux",
"react-router",
"redux",
"react-router-redux"
]
},
"output": {
"path": "/Users/Bart/Dev/wh3rk/dist/[hash]/",
"publicPath": "/[hash]/",
"filename": "[name].[hash].js",
"chunkFilename": "[id].[hash].js",
"sourceMapFilename": "[file].map",
"library": "App",
"libraryTarget": "umd"
},
"resolve": {
"extensions": [
"",
".js",
".jsx",
".scss",
".json",
".html",
".svg",
".jpg",
".png",
".ico"
],
"root": "/Users/Bart/Dev/wh3rk",
"modulesDirectories": [
"/Users/Bart/Dev/wh3rk/node_modules",
"/Users/Bart/Dev/wh3rk/src"
],
"fallback": "/Users/Bart/Dev/wh3rk/node_modules",
"alias": {
"react": "/Users/Bart/Dev/wh3rk/node_modules/react"
}
},
"externals": {
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true,
"ws": true
},
"node": {
"fs": "empty",
"net": "empty",
"tls": "empty",
"dns": "empty"
},
"resolveLoader": {
"fallback": "/Users/Bart/Dev/wh3rk/node_modules"
},
"module": {
"noParse": [
"ws"
],
"loaders": [
{
"test": {},
"loader": "json"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff2"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/octet-stream"
},
{
"test": {},
"loader": "file?prefix=fonts/&name=[path][name].[ext]"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=image/svg+xml"
},
{
"test": {},
"loaders": [
"file-loader",
"image-webpack?optimizationLevel=7&interlaced=false"
]
},
{
"test": {},
"loader": "babel",
"query": {
"presets": [
"react",
[
"es2015",
{
"modules": false
}
],
"stage-0"
]
},
"include": "/Users/Bart/Dev/wh3rk/src"
},
{
"test": {},
"loaders": [
"style",
"css?modules&localIdentName=[local]__[hash:base64:4]&importLoaders=1&sourceMap",
"postcss",
"sass?sourceMap"
]
}
]
},
"postcss": [
function (css, result) {\n var prefixes, ref;\n prefixes = loadPrefixes({\n from: (ref = css.source) != null ? ref.input.file : void 0\n });\n timeCapsule(result, prefixes);\n if (options.remove !== false) {\n prefixes.processor.remove(css);\n }\n if (options.add !== false) {\n return prefixes.processor.add(css, result);\n }\n }
],
"eslint": {
"configFile": "/Users/Bart/Dev/wh3rk/.eslintrc.js"
},
"plugins": [
{
"definitions": {
"__DEV__": true,
"__PROD__": false,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": true
}
},
{},
{},
{
"options": {
"template": "/Users/Bart/Dev/wh3rk/src/static/index.html",
"filename": "index.html",
"hash": true,
"inject": "body",
"compile": true,
"favicon": "/Users/Bart/Dev/wh3rk/src/static/favicon.ico",
"minify": {
"collapseWhitespace": true
},
"cache": true,
"showErrors": true,
"chunks": "all",
"excludeChunks": [],
"title": "wh3rk",
"xhtml": false,
"appMountId": "root",
"mobile": true
}
},
{
"options": {
"assets": {
"scss": {
"extensions": [
"scss"
],
"filter": (module, regex, options, log) => {\n if (options.development) {\n return plugin.styleLoaderFilter(module, regex, options, log);\n }\n\n return regex.test(module.name);\n },
"path": (module, options, log) => {\n if (options.development) {\n return plugin.styleLoaderPathExtractor(module, options, log);\n }\n\n return module.name;\n },
"parser": (module, options, log) => {\n if (options.development) {\n return plugin.cssModulesLoaderParser(module, options, log);\n }\n\n return module.source;\n }
}
},
"webpack_assets_file_path": "../webpack-assets.json",
"webpack_stats_file_path": "../webpack-stats.json",
"development": true
},
"log": {
"options": {},
"preamble": "[webpack-isomorphic-tools/plugin]"
},
"regular_expressions": {
"scss": {}
}
},
{
"fullBuildTimeout": 200
},
{
"definitions": {
"process.env.NODE_ENV": "\"test\"",
"__DEV__": true,
"__PROD__": false,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": true
}
}
],
"stats": {
"chunks": false,
"chunkModules": false,
"colors": true,
"assets": true,
"cached": false,
"cachedAssets": false,
"children": false,
"errorDetails": false,
"hash": false,
"modules": false,
"reasons": false,
"source": false,
"timings": true,
"version": true
},
"DEPENDENCY_TREE" [1]: {}
}
[1] "DEPENDENCY_TREE" is not allowed
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/Bart/.nvm/versions/node/v6.2.2/bin/node" "/Users/Bart/.nvm/versions/node/v6.2.2/bin/npm" "run-script" "validate:test"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! whr3k@0.0.21 validate:test: `NODE_ENV=test webpack-validator webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whr3k@0.0.21 validate:test script 'NODE_ENV=test webpack-validator webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the whr3k package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=test webpack-validator webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs whr3k
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls whr3k
npm ERR! There is likely additional logging output above.
{
"context": "/Users/Bart/Dev/wh3rk/src",
"entry": {
"app": [
"react-hot-loader/patch",
"webpack-hot-middleware/client",
"/Users/Bart/Dev/wh3rk/src/client.js"
],
"vendor": [
"react",
"react-redux",
"react-router",
"redux",
"react-router-redux"
]
},
"output": {
"path": "/Users/Bart/Dev/wh3rk/dist",
"publicPath": "/",
"filename": "[name].[hash].js",
"chunkFilename": "[id].[hash].js",
"sourceMapFilename": "[file].map"
},
"resolve": {
"extensions": [
"",
".js",
".jsx",
".scss",
".json",
".html",
".svg",
".jpg",
".png",
".ico"
],
"root": "/Users/Bart/Dev/wh3rk",
"modulesDirectories": [
"/Users/Bart/Dev/wh3rk/node_modules",
"/Users/Bart/Dev/wh3rk/src"
],
"fallback": "/Users/Bart/Dev/wh3rk/node_modules",
"alias": {
"react": "/Users/Bart/Dev/wh3rk/node_modules/react"
}
},
"externals": {
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true,
"ws": true
},
"node": {
"fs": "empty",
"net": "empty",
"tls": "empty",
"dns": "empty"
},
"resolveLoader": {
"fallback": "/Users/Bart/Dev/wh3rk/node_modules"
},
"module": {
"noParse": [
"ws"
],
"loaders": [
{
"test": {},
"loader": "json"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff2"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/octet-stream"
},
{
"test": {},
"loader": "file?prefix=fonts/&name=[path][name].[ext]"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=image/svg+xml"
},
{
"test": {},
"loaders": [
"file-loader",
"image-webpack?optimizationLevel=7&interlaced=false"
]
},
{
"test": {},
"loader": "babel",
"query": {
"presets": [
"react",
[
"es2015",
{
"modules": false
}
],
"stage-0"
],
"plugins": [
"react-hot-loader/babel"
]
},
"include": "/Users/Bart/Dev/wh3rk/src"
},
{
"test": {},
"loaders": [
"style",
"css?modules&localIdentName=[local]__[hash:base64:4]&importLoaders=1&sourceMap",
"postcss",
"sass?sourceMap"
]
}
]
},
"postcss": [
function (css, result) {\n var prefixes, ref;\n prefixes = loadPrefixes({\n from: (ref = css.source) != null ? ref.input.file : void 0\n });\n timeCapsule(result, prefixes);\n if (options.remove !== false) {\n prefixes.processor.remove(css);\n }\n if (options.add !== false) {\n return prefixes.processor.add(css, result);\n }\n }
],
"eslint": {
"configFile": "/Users/Bart/Dev/wh3rk/.eslintrc.js"
},
"plugins": [
{
"definitions": {
"__DEV__": true,
"__PROD__": false,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": true
}
},
{},
{},
{
"options": {
"template": "/Users/Bart/Dev/wh3rk/src/static/index.html",
"filename": "index.html",
"hash": true,
"inject": "body",
"compile": true,
"favicon": "/Users/Bart/Dev/wh3rk/src/static/favicon.ico",
"minify": {
"collapseWhitespace": true
},
"cache": true,
"showErrors": true,
"chunks": "all",
"excludeChunks": [],
"title": "wh3rk",
"xhtml": false,
"appMountId": "root",
"mobile": true
}
},
{
"options": {
"assets": {
"scss": {
"extensions": [
"scss"
],
"filter": (module, regex, options, log) => {\n if (options.development) {\n return plugin.styleLoaderFilter(module, regex, options, log);\n }\n\n return regex.test(module.name);\n },
"path": (module, options, log) => {\n if (options.development) {\n return plugin.styleLoaderPathExtractor(module, options, log);\n }\n\n return module.name;\n },
"parser": (module, options, log) => {\n if (options.development) {\n return plugin.cssModulesLoaderParser(module, options, log);\n }\n\n return module.source;\n }
}
},
"webpack_assets_file_path": "../webpack-assets.json",
"webpack_stats_file_path": "../webpack-stats.json",
"development": true
},
"log": {
"options": {},
"preamble": "[webpack-isomorphic-tools/plugin]"
},
"regular_expressions": {
"scss": {}
}
},
{
"fullBuildTimeout": 200
},
{
"definitions": {
"process.env.NODE_ENV": "\"development\"",
"__DEV__": true,
"__PROD__": false,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": true
}
}
],
"devtool": "cheap-module-eval-source-map",
"stats": {
"chunks": false,
"chunkModules": false,
"colors": true,
"assets": true,
"cached": false,
"cachedAssets": false,
"children": false,
"errorDetails": false,
"hash": false,
"modules": false,
"reasons": false,
"source": false,
"timings": true,
"version": true
},
"DEPENDENCY_TREE" [1]: {}
}
[1] "DEPENDENCY_TREE" is not allowed
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/Bart/.nvm/versions/node/v6.2.2/bin/node" "/Users/Bart/.nvm/versions/node/v6.2.2/bin/npm" "run-script" "validate:dev"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! whr3k@0.0.21 validate:dev: `NODE_ENV=development webpack-validator webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the whr3k@0.0.21 validate:dev script 'NODE_ENV=development webpack-validator webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the whr3k package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! NODE_ENV=development webpack-validator webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs whr3k
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls whr3k
npm ERR! There is likely additional logging output above.
{
"context": "/Users/Bart/Dev/wh3rk/src",
"entry": {
"app": [
"/Users/Bart/Dev/wh3rk/src/client.js"
],
"vendor": [
"react",
"react-redux",
"react-router",
"redux",
"react-router-redux",
"react",
"react-redux",
"react-router",
"redux",
"react-router-redux"
]
},
"output": {
"path": "/Users/Bart/Dev/wh3rk/dist/[hash]/",
"publicPath": "/[hash]/",
"filename": "[name].[hash].js",
"chunkFilename": "[id].[hash].js",
"sourceMapFilename": "[file].map",
"library": "App",
"libraryTarget": "umd"
},
"resolve": {
"extensions": [
"",
".js",
".jsx",
".scss",
".json",
".html",
".svg",
".jpg",
".png",
".ico"
],
"root": "/Users/Bart/Dev/wh3rk",
"modulesDirectories": [
"/Users/Bart/Dev/wh3rk/node_modules",
"/Users/Bart/Dev/wh3rk/src"
],
"fallback": "/Users/Bart/Dev/wh3rk/node_modules",
"alias": {
"react": "/Users/Bart/Dev/wh3rk/node_modules/react"
}
},
"externals": {
"react/lib/ExecutionEnvironment": true,
"react/lib/ReactContext": true,
"ws": true
},
"node": {
"fs": "empty",
"net": "empty",
"tls": "empty",
"dns": "empty"
},
"resolveLoader": {
"fallback": "/Users/Bart/Dev/wh3rk/node_modules"
},
"module": {
"noParse": [
"ws"
],
"loaders": [
{
"test": {},
"loader": "json"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/font-woff2"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=application/octet-stream"
},
{
"test": {},
"loader": "file?prefix=fonts/&name=[path][name].[ext]"
},
{
"test": {},
"loader": "url?prefix=fonts/&name=[path][name].[ext]&limit=10000&mimetype=image/svg+xml"
},
{
"test": {},
"loaders": [
"file-loader",
"image-webpack?optimizationLevel=7&interlaced=false"
]
},
{
"test": {},
"loader": "babel",
"query": {
"presets": [
"react",
[
"es2015",
{
"modules": false
}
],
"stage-0"
]
},
"include": "/Users/Bart/Dev/wh3rk/src"
},
{
"test": {},
"loader": "/Users/Bart/Dev/wh3rk/node_modules/extract-text-webpack-plugin/loader.js?{\"omit\":1,\"remove\":true}!style-loader!css?modules&localIdentName=[hash:base64:4]&importLoaders=1&sourceMap?postcss?sass?sourceMap"
}
]
},
"postcss": [
function (css, result) {\n var prefixes, ref;\n prefixes = loadPrefixes({\n from: (ref = css.source) != null ? ref.input.file : void 0\n });\n timeCapsule(result, prefixes);\n if (options.remove !== false) {\n prefixes.processor.remove(css);\n }\n if (options.add !== false) {\n return prefixes.processor.add(css, result);\n }\n }
],
"eslint": {
"configFile": "/Users/Bart/Dev/wh3rk/.eslintrc.js"
},
"plugins": [
{
"definitions": {
"__DEV__": false,
"__PROD__": true,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": false
}
},
{},
{},
{
"options": {
"template": "/Users/Bart/Dev/wh3rk/src/static/index.html",
"filename": "index.html",
"hash": true,
"inject": "body",
"compile": true,
"favicon": "/Users/Bart/Dev/wh3rk/src/static/favicon.ico",
"minify": {
"collapseWhitespace": true
},
"cache": true,
"showErrors": true,
"chunks": "all",
"excludeChunks": [],
"title": "wh3rk",
"xhtml": false,
"appMountId": "root",
"mobile": true
}
},
{
"options": {
"assets": {
"scss": {
"extensions": [
"scss"
],
"filter": (module, regex, options, log) => {\n if (options.development) {\n return plugin.styleLoaderFilter(module, regex, options, log);\n }\n\n return regex.test(module.name);\n },
"path": (module, options, log) => {\n if (options.development) {\n return plugin.styleLoaderPathExtractor(module, options, log);\n }\n\n return module.name;\n },
"parser": (module, options, log) => {\n if (options.development) {\n return plugin.cssModulesLoaderParser(module, options, log);\n }\n\n return module.source;\n }
}
},
"webpack_assets_file_path": "../webpack-assets.json",
"webpack_stats_file_path": "../webpack-stats.json",
"development": false
},
"log": {
"options": {},
"preamble": "[webpack-isomorphic-tools/plugin]"
},
"regular_expressions": {
"scss": {}
}
},
{
"filename": "app.[contenthash:20].css",
"id": 1,
"options": {}
},
{},
{
"options": {
"compressor": {
"warnings": false,
"unused": true,
"dead_code": true
},
"compress": {
"warnings": false,
"unused": true,
"dead_code": true
}
}
},
{
"definitions": {
"process.env.NODE_ENV": "\"production\"",
"__DEV__": false,
"__PROD__": true,
"__SERVER__": true,
"__CLIENT__": false,
"__DEBUG__": false
}
}
],
"devtool": "source-map",
"stats": {
"chunks": true,
"chunkModules": true,
"colors": true,
"assets": true,
"cached": false,
"cachedAssets": false,
"children": false,
"errorDetails": false,
"hash": false,
"modules": false,
"reasons": false,
"source": false,
"timings": true,
"version": true
},
"bail": true,
"cache": true,
"DEPENDENCY_TREE" [1]: {}
}
[1] "DEPENDENCY_TREE" is not allowed
Sorry, i am not able to reproduce your problem. Supplying schemaExtension
like you do should work. Could you provide a isolated repo that reproduces the error?
@jonathanewerner sorry for the delay and here is as per request an isolated repo that reproduces the error: dependency-tree-issue
I'm using Webpack2 and webpack-config and despite having everything working, I'm getting failed validation due to [1] "DEPENDENCY_TREE" is not allowed.
Whats that all about?