build: build with env

This commit is contained in:
EnixCoda 2019-08-24 17:41:57 +08:00
parent 87f141d12e
commit bd5409d277
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
5 changed files with 24 additions and 1 deletions

0
.env.example Normal file
View file

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.vscode
.env
node_modules
tmp
dist

View file

@ -45,6 +45,7 @@
"babel-loader": "^8.0.5",
"copy-webpack-plugin": "^5.0.0",
"css-loader": "^2.1.0",
"dotenv-webpack": "^1.7.0",
"file-loader": "^3.0.1",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"fsevents": "^1.2.4",

View file

@ -2,6 +2,7 @@ const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const path = require('path')
const Dotenv = require('dotenv-webpack')
const srcPath = path.resolve(__dirname, 'src')
const packagesPath = path.resolve(__dirname, 'packages')
@ -18,6 +19,7 @@ const plugins = [
},
]),
new ForkTsCheckerWebpackPlugin(),
new Dotenv(),
]
const IN_PRODUCTION_MODE = process.env.NODE_ENV === 'production'
@ -27,7 +29,7 @@ if (IN_PRODUCTION_MODE) {
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
})
}),
)
}

View file

@ -2197,6 +2197,25 @@ domutils@^1.7.0:
dom-serializer "0"
domelementtype "1"
dotenv-defaults@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-1.0.2.tgz#441cf5f067653fca4bbdce9dd3b803f6f84c585d"
integrity sha512-iXFvHtXl/hZPiFj++1hBg4lbKwGM+t/GlvELDnRtOFdjXyWP7mubkVr+eZGWG62kdsbulXAef6v/j6kiWc/xGA==
dependencies:
dotenv "^6.2.0"
dotenv-webpack@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-1.7.0.tgz#4384d8c57ee6f405c296278c14a9f9167856d3a1"
integrity sha512-wwNtOBW/6gLQSkb8p43y0Wts970A3xtNiG/mpwj9MLUhtPCQG6i+/DSXXoNN7fbPCU/vQ7JjwGmgOeGZSSZnsw==
dependencies:
dotenv-defaults "^1.0.2"
dotenv@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==
duplexify@^3.4.2, duplexify@^3.6.0:
version "3.7.1"
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"