ionic-team / vscode-extension

15 stars 0 forks source link

Project Build vs script "build" #154

Closed rgilsimoes closed 8 months ago

rgilsimoes commented 10 months ago

Problem: Project Build runs

npx ionic build && npx cap copy
vite build

while script "npm run build" runs:

tsc && vite build

This is also what runs on AppFlow, so usually some Typescript compilation errors are not picked up just by running the Build command on the extension.

Desired behaviour should be that the Build option checks for compilation errors like AppFlow build commands.

Ionic VS Code Extension: v1.65.2 VS Code version:

Version: 1.85.1 (Universal) Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 Date: 2023-12-13T09:48:06.308Z Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Darwin arm64 23.2.0

////////// Ionic:

Ionic CLI : 7.1.5 (/Users/ricar/Library/Application Support/fnm/node-versions/v18.18.0/installation/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/react 7.6.3

Capacitor:

Capacitor CLI : 5.6.0 @capacitor/android : 5.6.0 @capacitor/core : 5.6.0 @capacitor/ios : 5.6.0

Utility:

cordova-res : not installed globally native-run : 2.0.0

System:

NodeJS : v18.18.0 (/Users/ricar/Library/Application Support/fnm/node-versions/v18.18.0/installation/bin/node) npm : 10.2.4 OS : macOS Unknown

dtarnawsky commented 9 months ago

I think in your case tsc && vite build is a build command you have added to appflow.config.json ?

One way you can modify how your app is built is be adding ionic:build to the scripts section of package.json and putting in the command tsc && vite build. That way the Ionic cli will use that to build.

rgilsimoes commented 8 months ago

That works!

dtarnawsky commented 8 months ago

Awesome that this worked for you.

In the latest version of the extension (v1.80), you'll see that the serve and build commands are no longer using the Ionic CLI. They now guess at the right build/serve commands (using ionic.config.json's type as a guide) or they look for either serve , build or ionic:serve, ionic:build scripts in your package.json.