These are chat archives for AngularClass/NG6-starter

9th
Mar 2016
Forrest Loomis
@cybercyst
Mar 09 2016 15:04
Hi everyone, I'm looking to use NG6-Starter for a project I'm working on, and I'm hitting a roadblock. I need to either split out my config.js file to its own file, or at least stop that file from being bundled, so that Jenkins can configure it per environment, and it can be configured in the end environment... I've been reading some webpack documentation, but having trouble wrapping my head around it. I wonder if anyone has any pointers?
Sergey Protko
@fesor
Mar 09 2016 15:24

@cybercyst I think i should add wiki page about this.

Personaly I use module aliases:

resolve: {
    root: __dirname + '/frontend',
    alias: {
      'app-config': `./../config/${argv.release ? 'release' : 'local' }.js`
    }
  },
and then just import it as usual module.
import config from 'app-config';
so you can set config path dynamicly
Forrest Loomis
@cybercyst
Mar 09 2016 15:34
@fesor: So our set up is pretty wonky, actually :) We have a config.json with key values for dev, stg, prod, and then we generate a config.js file that we can use for dev work. When we push to the git repo, a debian package file is created, that has a postinstall that generates that config.js, depending on the environment it is has been installed in.
Sergey Protko
@fesor
Mar 09 2016 15:35
@cybercyst sooo... what?)
Forrest Loomis
@cybercyst
Mar 09 2016 15:35
Unfortunately, I can't really change those steps that are out of my control, just try to set up an environment that works in similar way
Sergey Protko
@fesor
Mar 09 2016 15:35
@cybercyst just prepare config file, maybe change path for alias, and build project
Forrest Loomis
@cybercyst
Mar 09 2016 15:35
So, i basically need to not bundle config.js
Sergey Protko
@fesor
Mar 09 2016 15:35
you could exclude it from bundling
Forrest Loomis
@cybercyst
Mar 09 2016 15:37
although if I could split config.js's module into its own file, then that file could be replaced by the debian package's postinstall's bash script
Thanks @fesor -- I'm taking a look :)