update-ns-webpack, error updating webpack config #1144
Description
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
-
CLI: 6.8.0
-
Plugin(s): nativescript-stripe
-
Node.js: v12.18.3
-
Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack
-
package.json: https://pastebin.pl/view/13670ec9
-
webpack.config.js: https://pastebin.pl/view/4b6a757b
Describe the bug
Error showing after launching ./node_modules/.bin/update-ns-webpack --configs
:
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module '../projectHelpers'
Require stack:
- **project_dir**/node_modules/@nativescript/webpack/verify/update.js
- **project_dir**/node_modules/@nativescript/webpack/bin/update-ns-webpack
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (**project_dir**/node_modules/@nativescript/webpack/verify/update.js:8:5)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'**project_dir**/node_modules/@nativescript/webpack/verify/update.js',
'**project_dir**/node_modules/@nativescript/webpack/bin/update-ns-webpack'
]
}
(paths are hidden by myself, they're showing correctly in the original output)
To Reproduce
I was updating an old project (a plugin), after running npm install
i received a notice:
Note: webpack.config.js is different than the suggested @nativescript/webpack config at ..project_dir/node_modules/@nativescript/webpack/templates/webpack.angular.js.
If you have build trouble you can update to latest config using "./node_modules/.bin/update-ns-webpack --configs" command.
Running the suggested command is throwing the error.
Expected behavior
- the update command should be updated to the latest version
- it should update your webpack configuration without any errors
Additional context
I was going to open a PR to fix this, unfortunately the github repo doesn't seem to be aligned with the latest npm release (2.1.3), the most updated branch (feat/webpack-updates) is at 2.0.0-alpha.3 ... Please, if possible keep repo's tags aligned in order to let people contribute ;)
** Fix **
const {
getPackageJson,
getProjectDir,
writePackageJson,
} = require("../projectHelpers");
Replace with:
const {
getPackageJson,
getProjectDir,
writePackageJson,
} = require("../helpers/projectHelpers");