Jordi
Jordi

Reputation: 23237

webpack: variable not defined

I'm handling with this problem when I perform:

webpack --config config/webpack.prod.js  --progress --profile --bail

The message it dumps is: path is not defined.

D:\projects\living\user-platform\project\config\webpack.prod.js:196
            resourcePath: path.resolve(projectRoot, appConfig.root)
                          ^
ReferenceError: path is not defined
    at module.exports (D:\projects\living\user-platform\project\config\webpack.prod.js:196:27)
    at requireConfig (C:\Users\Beep\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:104:15)
    at C:\Users\Beep\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:111:17
    at Array.forEach (native)
    at module.exports (C:\Users\Beep\AppData\Roaming\npm\node_modules\webpack\bin\convert-argv.js:109:15)
    at Object.<anonymous> (C:\Users\Beep\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:141:40)
    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:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

These are my webpack configuration files:

Upvotes: 2

Views: 1021

Answers (1)

Filip Dupanović
Filip Dupanović

Reputation: 33650

Seems like an easy problem. Can you try adding this somewhere at the top and see if everything works:

var path = require('path');

Upvotes: 1

Related Questions