Skip to content

Allow package.json to define what "ionic build" and "ionic serve" do in custom projects #3819

Closed

Description

@Giwayume

Looking at CLI 4.8.0, custom projects are hard-coded to always throw an error upon build/serve, without a way to define a custom build/serve process.

I would expect ionic build by default to run tasks that are not specific to Angular, such as auto-generating the app icon and splash screen assets, and allow a hook in the package.json of the project to run other custom build tasks if needed.

This is a small roadblock for Vue adoption.

Activity

  1. imhoffd commented on Jan 18, 2019

    @imhoffd
    Contributor

    Thanks, that makes sense. This was just an oversight.

  2. imhoffd commented on Jan 18, 2019

    @imhoffd
    Contributor

    Just pushed a commit that makes this work with projects generated by the Vue CLI.

    Choose custom during ionic init:

    $ ionic init
    

    ionic.config.json is generated.

    {
      "name": "test",
      "integrations": {},
      "type": "custom"
    }
    

    Make the following modifications to package.json:

       "scripts": {
    +    "ionic:build": "vue-cli-service build",
    +    "ionic:serve": "vue-cli-service serve",
         "serve": "vue-cli-service serve",
         "build": "vue-cli-service build",
         "lint": "vue-cli-service lint"
       },

    ionic build & ionic serve (and build/serve during Cordova/Capacitor commands) will now work using the vue-cli-service!

    This will be in Ionic CLI 4.9.0. Thanks!

  3. hiepxanh commented on Jan 31, 2019

    @hiepxanh

    hello sir, I see that angular HMR here angular hmr have custom code like npm run hmr. Can I use ionic:build to npm run hmr. So my ionic cordova run android -l will become Hot module reload instead of live reload????

  4. imhoffd commented on Jan 31, 2019

    @imhoffd
    Contributor

    ionic:build is not used with ionic cordova run android if that -l flag is used because that's for livereload.

  5. tomchiverton commented on Feb 2, 2022

    @tomchiverton

    The main AppFlow Vue example project is missing these two lines :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions