Skip to content

Need help on generating environment specific api config #11

Closed
@hussaintamboli

Description

@hussaintamboli

Hey, I have been using generator-angular-webpack-es6 for a week now.

I really like how it's structured in a context of separation of concerns.

I have one problem. My api.config.json

{
    "production": {
        "APIConfig": {
            "ProductService": "jjjjjjjjj",
            "CartService": "kkkkkkk"
        }
    },
    "development": {
        "APIConfig": {
            "ProductService": "lllllllll",
            "CartService": "mmmmm"
        }
    }
}

I want webpack to create angular config for the enviornment specific build.

In gulp I had a task for this

gulp.task('configure-environment', configure);
function configure() {
  return gulp.src('conf/app.env.config.json')
    .pipe(gulpNgConfig('MyMD.config', {
      environment: process.env.NODE_ENV || "development"
    }))
    .pipe(gulp.dest(path.join(conf.paths.src)));
}

How do I do this with Webpack?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions