When using requirejs, I do this:
require.config({
baseUrl: "scripts"
});
console.log("Starting!");
require(["A", "B", "C"], mainFunction);
I was googling how to set the base path for Webpack. I found resolve.root. However that just doesn't work:
$ node run_with_node.js
D:\node_modules\webpack\lib\webpack.js:19
throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
^
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.resolve has an unknown property 'root'. These properties are valid:
object { alias?, aliasFields?, cachePredicate?, descriptionFiles?, enforceExtension?, enforceModuleExtension?, extensions?, fileSystem?, mainFields?, mainFiles?, moduleExtensions?, modules?, plugins?, resolver?, symlinks?, unsafeCache?, useSyncFileSystemCalls? }
at webpack (D:\node_modules\webpack\lib\webpack.js:19:9)
at Object.<anonymous> (D:\web\voxnap\run_with_node.js:9:18)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:425:7)
at startup (bootstrap_node.js:146:9)
I also tried to use resolve.modules, but if I did that, Webpack couldn't find internal modules from babeljs.
Error: Cannot find module "babel-runtime/helpers/typeof"
So how to properly add a directory that contains my scripts?