switch config.json based on NODE_ENV

This commit is contained in:
Peter Cai 2021-11-24 17:58:38 -05:00
parent 4f06a2639e
commit b23d99ffe8
4 changed files with 9 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
dist
wrangler.*
config.json
config.prod.json

View File

@ -7,7 +7,7 @@
"build": "webpack",
"dev": "wrangler -c wrangler.dev.toml dev",
"publish-dev": "wrangler -c wrangler.dev.toml publish",
"publish-prod": "wrangler -c wrangler.prod.toml publish",
"publish-prod": "NODE_ENV=production wrangler -c wrangler.prod.toml publish",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "PeterCxy",

View File

@ -1,4 +1,4 @@
import config from "../config.json"
import config from "config"
import * as crypto from "./crypto"
import S3 from "./aws/s3"

View File

@ -1,4 +1,5 @@
const path = require('path')
const { config } = require('process')
module.exports = {
entry: './src/index.coffee',
@ -10,6 +11,10 @@ module.exports = {
resolve: {
extensions: ['.coffee', '.js'],
fallback: { "os": false },
alias: {
config: path.resolve(__dirname,
process.env.NODE_ENV == "production" ? "config.prod.json" : "config.json")
}
},
module: {
rules: [