support NODE_ENV
This commit is contained in:
parent
24b07f3d95
commit
10ef547da7
|
@ -9,7 +9,7 @@
|
||||||
"format": "prettier --write '**/*.{js,css,json,md}'",
|
"format": "prettier --write '**/*.{js,css,json,md}'",
|
||||||
"build-web": "webpack-cli --config webpack.config.web.js",
|
"build-web": "webpack-cli --config webpack.config.web.js",
|
||||||
"build": "npm run build-web && wrangler build",
|
"build": "npm run build-web && wrangler build",
|
||||||
"preview": "npm run build-web && wrangler preview"
|
"preview": "NODE_ENV=development npm run build-web && wrangler preview"
|
||||||
},
|
},
|
||||||
"author": "Peter Cai <peter@typeblog.net>",
|
"author": "Peter Cai <peter@typeblog.net>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
var process = require("process")
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: "webworker",
|
target: "webworker",
|
||||||
entry: "./index.js",
|
entry: "./index.js",
|
||||||
mode: "production",
|
mode: "production", // CF Worker only works in production mode
|
||||||
optimization: {
|
optimization: {
|
||||||
// We no not want to minimize our code.
|
// We no not want to minimize our code.
|
||||||
minimize: false
|
minimize: process.env.NODE_ENV == "production"
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.coffee']
|
extensions: ['.js', '.coffee']
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
var HtmlWebpackPlugin = require("html-webpack-plugin")
|
var HtmlWebpackPlugin = require("html-webpack-plugin")
|
||||||
var HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin")
|
var HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin")
|
||||||
var path = require("path")
|
var path = require("path")
|
||||||
|
var process = require("process")
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: "web",
|
target: "web",
|
||||||
entry: "./index-web.js",
|
entry: "./index-web.js",
|
||||||
mode: "development",
|
mode: process.env.NODE_ENV ? process.env.NODE_ENV : "development",
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, "./worker"),
|
path: path.resolve(__dirname, "./worker"),
|
||||||
filename: "web.js"
|
filename: "web.js"
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
// We no not want to minimize our code.
|
// We no not want to minimize our code.
|
||||||
minimize: false
|
minimize: process.env.NODE_ENV == "production"
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.coffee']
|
extensions: ['.js', '.coffee']
|
||||||
|
|
Loading…
Reference in a new issue