Skip to content

Commit d78faf3

Browse files
committed
fix get path user project in ns/webpack
1 parent db83405 commit d78faf3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/debug-adapter/nativeScriptDebugAdapter.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,18 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter {
291291

292292
private getWebpackConfig(webRoot: string, platform: string) {
293293
const webpackConfigFile = join(webRoot, 'webpack.config.js');
294+
const pathProcess = process.cwd();
295+
294296
if (existsSync(webpackConfigFile)) {
295297
try {
298+
// Apply the project path so that ns/webpack can resolve the path
299+
process.chdir(webRoot);
296300
const webpackConfig = require(webpackConfigFile);
297-
return webpackConfig({ [`${platform}`]: platform });
301+
const webpackConfigResult = webpackConfig({ [`${platform}`]: platform });
302+
process.chdir(pathProcess);
303+
return webpackConfigResult;
298304
} catch (err) {
305+
process.chdir(pathProcess);
299306
logger.warn(`Error when trying to require webpack.config.js file from path '${webpackConfigFile}'. Error is: ${err}`);
300307
}
301308
}

0 commit comments

Comments
 (0)