Last active
July 13, 2018 20:52
-
-
Save selahattinunlu/d19d69a5cd4b9ba6e0f76f26babba70d to your computer and use it in GitHub Desktop.
example for extend ionic/app-scripts/config/webpack.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// don't forget to install "lodash" "dotenv" | |
var ionicWebpackConfig = require('@ionic/app-scripts/config/webpack.config.js'); | |
var webpack = require('webpack'); | |
var _ = require('lodash'); | |
var dotenvConfig = require('dotenv').config(); | |
var dev = ionicWebpackConfig.dev; | |
var prod = ionicWebpackConfig.prod; | |
var loadProcessEnvValues = function() { | |
return new webpack.DefinePlugin({ | |
'process.env': _(process.env) | |
.pick(_.keys(dotenvConfig.parsed)) | |
.mapValues((v) => (JSON.stringify(v))) | |
.value() | |
}); | |
}; | |
dev.plugins.push(loadProcessEnvValues()); | |
prod.plugins.push(loadProcessEnvValues()); | |
module.exports = { | |
dev: dev, | |
prod: prod | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool, thanks for this.
As a reference after adapted the gist
(we use awesome-typescript-loader as TS loader)