NativeScript / capacitor

NativeScript for Capacitor
https://capacitor.nativescript.org
36 stars 9 forks source link

Error Cannot read properties of undefined (reading 'join') in webpack plugin #30

Open Ionaru opened 3 months ago

Ionaru commented 3 months ago

When following the Nativescript for Capacitor installation instructions, the script npm run build:mobile (after fixing #28 and #29) errors with this message:

[webpack-cli] TypeError: Cannot read properties of undefined (reading 'join')
    at PlatformSuffixPlugin.apply (C:\Users\NAME\Projects\PROJECT\node_modules\@nativescript\webpack\dist\plugins\PlatformSuffixPlugin.js:28:61)
    at createCompiler (C:\Users\NAME\Projects\PROJECT\node_modules\webpack\lib\webpack.js:76:12)
    at create (C:\Users\NAME\Projects\PROJECT\node_modules\webpack\lib\webpack.js:143:16)
    at webpack (C:\Users\NAME\Projects\PROJECT\node_modules\webpack\lib\webpack.js:151:47)
    at WebpackCLI.f [as webpack] (C:\Users\NAME\Projects\PROJECT\node_modules\webpack\lib\index.js:73:16)
    at WebpackCLI.createCompiler (C:\Users\NAME\Projects\PROJECT\node_modules\webpack-cli\lib\webpack-cli.js:1789:29)
    at async WebpackCLI.runWebpack (C:\Users\NAME\Projects\PROJECT\node_modules\webpack-cli\lib\webpack-cli.js:1890:20)
    at async Command.<anonymous> (C:\Users\NAME\Projects\PROJECT\node_modules\webpack-cli\lib\webpack-cli.js:912:21)
    at async Promise.all (index 1)
    at async Command.<anonymous> (C:\Users\NAME\Projects\PROJECT\node_modules\webpack-cli\lib\webpack-cli.js:1372:13)
NativeScript build complete: undefined/nativescript/index.js

It looks like the error is coming from this line:

https://github.com/NativeScript/NativeScript/blob/db0a852f5bee60a306b4e3cb14664b6ac32601a2/packages/webpack5/src/plugins/PlatformSuffixPlugin.ts#L35

Where extensions is undefined.

My guess is that somewhere in https://github.com/NativeScript/capacitor/blob/main/src_bridge/webpack.config.js, an option needs to be added.

Ionaru commented 3 months ago

Duplicate of https://github.com/NativeScript/capacitor/issues/27, but the information may be useful.