Visitor,
- myArbitraryNumber,
- }}
- />
+
+ Visitor,
+ }}
+ />
+
+
+
+
The date is:
diff --git a/webpack.config.build.babel.js b/webpack.config.build.babel.js
index 27490d2..4f9eee9 100644
--- a/webpack.config.build.babel.js
+++ b/webpack.config.build.babel.js
@@ -6,20 +6,17 @@ import SaveAssetsJson from 'assets-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import precss from 'precss'
import postcssPresetEnv from 'postcss-preset-env'
+import AWS from 'aws-sdk'
+
import webpackConfig, { JS_SOURCE } from './webpack.config.common'
// ----------------------------------------------------------
// CONSTANT DECLARATION
// ----------------------------------------------------------
-
-const S3_DEPLOY = config.get('s3.s3Deploy') || 'false'
-const IS_S3_DEPLOY = String(S3_DEPLOY) === 'true'
-
-const PUBLIC_PATH = IS_S3_DEPLOY
- ? process.env.AWS_CDN_URL
- : config.get('publicPath')
-const APP_ENTRY_POINT = `${JS_SOURCE}/main`
+const IS_S3_DEPLOY = Boolean(process.env.S3_DEPLOY);
+const PUBLIC_PATH = IS_S3_DEPLOY ? process.env.AWS_CDN_URL : config.get('publicPath');
+const APP_ENTRY_POINT = `${JS_SOURCE}/main`;
// webpack 4 mode
// https://webpack.js.org/concepts/mode/
@@ -101,14 +98,21 @@ if (IS_S3_DEPLOY) {
// Please read README if you have no idea where
// `process.env.AWS_ACCESS_KEY` is coming from
+ let s3Options = {};
+ if (process.env.AWS_PROFILE) {
+ s3Options = new AWS.SharedIniFileCredentials({ profile: process.env.AWS_PROFILE });
+ }
+ if (process.env.AWS_ACCESS_KEY) {
+ s3Options.accessKeyId = process.env.AWS_ACCESS_KEY_ID;
+ }
+ if (process.env.AWS_SECRET_KEY) {
+ s3Options.secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
+ }
const s3Config = new S3Plugin({
// Only upload css and js
// include: /.*\.(css|js)/,
// s3Options are required
- s3Options: {
- accessKeyId: process.env.AWS_ACCESS_KEY,
- secretAccessKey: process.env.AWS_SECRET_KEY,
- },
+ ...s3Options,
s3UploadOptions: {
Bucket: process.env.AWS_BUCKET,
},
diff --git a/webpack.config.common.js b/webpack.config.common.js
index 64ab948..a01c9e5 100644
--- a/webpack.config.common.js
+++ b/webpack.config.common.js
@@ -5,6 +5,11 @@ import webpack from 'webpack';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
import config from 'config';
+// Please read the following link if
+// you have no idea how to use this feature
+// https://github.com/motdotla/dotenv
+require('dotenv').config({ silent: true });
+
// trace which loader is deprecated
// feel free to remove that if you don't need this feature
process.traceDeprecation = false;