switch config.json based on NODE_ENV
This commit is contained in:
parent
4f06a2639e
commit
b23d99ffe8
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
wrangler.*
|
wrangler.*
|
||||||
config.json
|
config.json
|
||||||
|
config.prod.json
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "webpack",
|
"build": "webpack",
|
||||||
"dev": "wrangler -c wrangler.dev.toml dev",
|
"dev": "wrangler -c wrangler.dev.toml dev",
|
||||||
"publish-dev": "wrangler -c wrangler.dev.toml publish",
|
"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"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "PeterCxy",
|
"author": "PeterCxy",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import config from "../config.json"
|
import config from "config"
|
||||||
import * as crypto from "./crypto"
|
import * as crypto from "./crypto"
|
||||||
import S3 from "./aws/s3"
|
import S3 from "./aws/s3"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const { config } = require('process')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: './src/index.coffee',
|
entry: './src/index.coffee',
|
||||||
|
@ -10,6 +11,10 @@ module.exports = {
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.coffee', '.js'],
|
extensions: ['.coffee', '.js'],
|
||||||
fallback: { "os": false },
|
fallback: { "os": false },
|
||||||
|
alias: {
|
||||||
|
config: path.resolve(__dirname,
|
||||||
|
process.env.NODE_ENV == "production" ? "config.prod.json" : "config.json")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
|
Loading…
Reference in a new issue