code-soup / wordpress-plugin-boilerplate

WordPress plugin boilerplate with Webpack and Composer. Remove repetitive tasks from your workflow, keep it simple and make coding fun again.
GNU General Public License v3.0
14 stars 3 forks source link

`yarn dev` fails with unfound 'config.devServer' #63

Closed varffs closed 8 months ago

varffs commented 8 months ago

Fairly self explanatory error:

$ webpack serve --hot --mode development --color --config src/config/config.webpack.js
[webpack-cli] Failed to load '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/src/config/config.webpack.js' config
[webpack-cli] Error: Cannot find module './webpack/config.devServer'
Require stack:
- /Users/xyz/abc/wp-content/plugins/nm-readability-analyser/src/config/config.webpack.js
- /Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/lib/webpack-cli.js
- /Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/lib/bootstrap.js
- /Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/bin/cli.js
- /Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack/bin/webpack.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/src/config/config.webpack.js:51:42)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/src/config/config.webpack.js',
    '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/lib/webpack-cli.js',
    '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/lib/bootstrap.js',
    '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack-cli/bin/cli.js',
    '/Users/xyz/abc/wp-content/plugins/nm-readability-analyser/node_modules/webpack/bin/webpack.js'
  ]
}
error Command failed with exit code 2.

I ran the setup scripts as required first. I can't see any 'config.devServer' in the repo, but it would seem to me that it could be generated by config. But can't find where that should be happening either.

Is this something simple I'm missing?

Bobz-zg commented 8 months ago

@varffs thanks for reporting, I have fixed the problem. Actual file that needed to be included was ./webpack/config.watch. Let me know if you spot anything else please.

varffs commented 8 months ago

Yep great. Changing that reference in /src/config/config.webpack.js allows yarn dev to run for me