Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: New local plugin doesn't compile #5436

Closed
Cyral opened this issue Feb 15, 2022 · 5 comments
Closed

bug: New local plugin doesn't compile #5436

Cyral opened this issue Feb 15, 2022 · 5 comments

Comments

@Cyral
Copy link

Cyral commented Feb 15, 2022

Bug Report

Capacitor Version

馃拪 Capacitor Doctor 馃拪

Latest Dependencies:

@capacitor/cli: 3.4.1
@capacitor/core: 3.4.1
@capacitor/android: 3.4.1
@capacitor/ios: 3.4.1

Installed Dependencies:

@capacitor/cli: 3.4.1
@capacitor/core: 3.4.1
@capacitor/android: 3.4.1
@capacitor/ios: 3.4.1

Platform(s)

N/A

Current Behavior

Newly created plugin should compile with npm run build

Expected Behavior

Compilation fails:

> test@0.0.1 build
> npm run clean && npm run docgen && tsc && rollup -c rollup.config.js


> test@0.0.1 clean
> rimraf ./dist


> test@0.0.1 docgen
> docgen --api testplPlugin --output-readme README.md --output-json dist/docs.json


鉁旓笍 DocGen Output: /frontend/app/testpl/dist/docs.json
鉁旓笍 DocGen Output: /frontend/app/testpl/README.md

../node_modules/@types/eslint-scope/node_modules/@types/eslint/helpers.d.ts:1:6 - error TS2300: Duplicate identifier 'Prepend'.

1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
       ~~~~~~~

  ../node_modules/@types/eslint/helpers.d.ts:1:6
    1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
           ~~~~~~~
    'Prepend' was also declared here.

../node_modules/@types/eslint/helpers.d.ts:1:6 - error TS2300: Duplicate identifier 'Prepend'.

1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
       ~~~~~~~

  ../node_modules/@types/eslint-scope/node_modules/@types/eslint/helpers.d.ts:1:6
    1 type Prepend<Tuple extends any[], Addend> = ((_: Addend, ..._1: Tuple) => any) extends (..._: infer Result) => any
           ~~~~~~~
    'Prepend' was also declared here.


Found 2 errors.

Code Reproduction

Create a new plugin with npm init @capacitor/plugin, then run npm run build

Other Technical Details

NPM Version: 8.3.1
Node Version: v16.14.0
Tested on Mac

@Cyral
Copy link
Author

Cyral commented Feb 15, 2022

I'm realizing that the error involves ../node_modules which is the node_modules of the parent app. Upon creating a blank capacitor app with a local plugin, the issue doesn't occur. I will keep looking to see why it is happening on my app and not a new one.

@Cyral Cyral closed this as completed Feb 15, 2022
@simonwalsh
Copy link

@Cyral I've got the exact some issue. Any luck?

@Cyral
Copy link
Author

Cyral commented Mar 24, 2022

@simonwalsh Add "skipLibCheck": true to the "compilerOptions" section in the tsconfig.json for the plugin. This will disable typechecking node_modules, which seems to be the default for every React app I have worked on, so I think it is okay. Apparently it's not set by default for capacitor plugins though.

@simonwalsh
Copy link

Ah! Thanks

@Cyral you just saved my ass 馃槃

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 10, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants