Skip to content

How to ionic serve --prod? #26

@Dercetech

Description

@Dercetech

Hi!

As the title says,, I'm trying to serve my environment locally with the prod settings; Doesn't work out of the box. After following the instructions on your root .md file, I've done this:

package.json
Add an npm run script:

 "serve:prod:win": "set MY_ENV=prod && ionic-app-scripts serve"

config/webpack.config.js
Update:

var env = process.env.MY_ENV;

// Set default environment to "dev"
env = env.trim();
console.log('>>>> chosen environment: "' + env + '"');

Doesn't seem quite right, even though the variable "prod" is shown to be properly selected via the console.log as I npm run serve:prod:win, it's still the dev file that's in use.

N.B. I don't quite understand webpack, so don't consider this an educated guess :-)

How would you approach this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions