Transpile error after import capacitor/core
See original GitHub issueDescription of the problem: I get a transpile error after import capacitor/core in the app.component.ts
Error:
Thomass-Mac-Pro:quest thomas$ ionic build
ionic-app-scripts build [15:14:32] ionic-app-scripts 3.2.2 [15:14:32] build dev started … [15:14:32] clean started … [15:14:32] clean finished in 5 ms [15:14:32] copy started … [15:14:32] deeplinks started … [15:14:32] deeplinks finished in 31 ms [15:14:32] transpile started … [15:14:37] typescript: node_modules/@capacitor/core/dist/esm/global.d.ts, line: 3 ‘=’ expected.
L2: declare var Capacitor: _Capacitor; L3: declare const Plugins: import("./core-plugin-definitions").PluginRegistry; L4: export { Capacitor, Plugins };
[15:14:37] typescript: node_modules/@capacitor/core/dist/esm/global.d.ts, line: 3 Cannot find name ‘import’.
L2: declare var Capacitor: _Capacitor; L3: declare const Plugins: import("./core-plugin-definitions").PluginRegistry; L4: export { Capacitor, Plugins };
[15:14:37] typescript: node_modules/@capacitor/core/dist/esm/global.d.ts, line: 3 Property ‘PluginRegistry’ does not exist on type ‘“./core-plugin-definitions”’.
L2: declare var Capacitor: _Capacitor; L3: declare const Plugins: import("./core-plugin-definitions").PluginRegistry; L4: export { Capacitor, Plugins };
[15:14:37] ionic-app-script task: “build” [15:14:37] Error: Failed to transpile program Error: Failed to transpile program at new BuildError (/Users/thomas/Documents/Again/quest/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at /Users/thomas/Documents/Again/quest/node_modules/@ionic/app-scripts/dist/transpile.js:159:20 at new Promise (<anonymous>) at transpileWorker (/Users/thomas/Documents/Again/quest/node_modules/@ionic/app-scripts/dist/transpile.js:107:12) at Object.transpile (/Users/thomas/Documents/Again/quest/node_modules/@ionic/app-scripts/dist/transpile.js:64:12) at /Users/thomas/Documents/Again/quest/node_modules/@ionic/app-scripts/dist/build.js:109:82 [ERROR] An error occurred while running subprocess ionic-app-scripts.
ionic-app-scripts build exited with exit code 1. Re-running this command with the --verbose flag may provide more information.
Affected platform
- Android
- iOS
- electron
- web
OS of the development machine
- Windows
- macOS
- linux
Other information: package.json file:
{
"name": "quest",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@capacitor/android": "^1.0.0-beta.25",
"@capacitor/cli": "1.0.0-beta.25",
"@capacitor/core": "^1.0.0-beta.25",
"@capacitor/ios": "^1.0.0-beta.25",
"@ionic-native/core": "~4.20.0",
"@ionic-native/splash-screen": "~4.20.0",
"@ionic-native/status-bar": "~4.20.0",
"@ionic/storage": "2.2.0",
"ionic-angular": "3.9.5",
"ionicons": "3.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.2",
"typescript": "~2.6.2"
},
"description": "An Ionic project"
}
Capacitor version: 1.0.0-beta.25
node version: 10.15.3
npm version: 6.4.1
Steps to reproduce:
- ionic start quest blank --type=ionic-angular --capacitor
- ionic build
- npx cap copy
- add import { Plugins } from ‘@capacitor/core’; to app.component.ts
- ionic build
Fully ionic info:
Ionic:
ionic (Ionic CLI) : 4.12.0 (/usr/local/lib/node_modules/ionic) Ionic Framework : ionic-angular 3.9.5 @ionic/app-scripts : 3.2.2
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.25 @capacitor/core : 1.0.0-beta.25
System:
NodeJS : v10.15.3 (/usr/local/bin/node) npm : 6.4.1 OS : macOS High Sierra
Issue Analytics
- State:
- Created 4 years ago
- Comments:29 (4 by maintainers)
Top GitHub Comments
In Plugins -> global.d.ts This work for me
import { Capacitor as _Capacitor } from ‘./definitions’; import * as _Plugins from “./core-plugin-definitions”; declare const Capacitor: _Capacitor;
declare const Plugins: _Plugins.PluginRegistry; export { Capacitor, Plugins };
Try updating typescript to 2.9 or newer