Closed
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.4.0
- Cross-platform modules: Not applicable
- Android Runtime: Not applicable
- iOS Runtime: Not applicable
- Plugin(s): Ensure you do not have
webpack
in your package.json
Describe the bug
When setting pnpm
to be used as package-manager, the CLI is unable to run the webpack process correctly on macOS and Linux. IT fails with error:
Preparing project...
/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/webpack-cli/bin/cli.js:244
throw err;
^
TypeError: Cannot set property 'dynamicImport' of undefined
at injectDynamicImport (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/acorn-dynamic-import/lib/inject.js:29:31)
at Object.<anonymous> (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/acorn-dynamic-import/lib/index.js:17:46)
at Module._compile (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/webpack/lib/Parser.js:9:15)
at Module._compile (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/webpack/lib/JavascriptModulesPlugin.js:7:16)
at Module._compile (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/webpack/lib/WebpackOptionsApply.js:9:33)
at Module._compile (/Users/vladimirov/Work/nativescript-cli/scratch/appPnpm/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Executing webpack failed with exit code 1.
To Reproduce
tns package-manager set pnpm
tns create appPnpm --js
cd appPnpm
tns prepare ios
Expected behavior
Prepare of project should succeed.
Sample project
Additional context
Works correctly on Windows. It seems the problem is caused of the way CLI starts the webpack process, i.e. with node --preserve-symlinks...
. This option is not required when pnpm is used according to this comment.