Fix production builds

This commit is contained in:
Grégoire Delattre 2019-05-14 14:36:20 +02:00
parent b510959c7c
commit bd20acd9e5
2 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,8 @@
{
"name": "canape",
"scripts": {
"start": "./node_modules/webpack/bin/webpack.js -d --progress --colors --watch",
"build": "./node_modules/webpack/bin/webpack.js --mode=production -p --progress --colors",
"start": "NODE_ENV=development ./node_modules/webpack/bin/webpack.js -d --progress --colors --watch",
"build": "NODE_ENV=production ./node_modules/webpack/bin/webpack.js -p --progress --colors",
"lint": "./node_modules/eslint/bin/eslint.js frontend/."
},
"dependencies": {

View File

@ -2,14 +2,18 @@ var webpack = require("webpack");
var path = require("path");
var WebpackPwaManifest = require("webpack-pwa-manifest")
var mode = "development";
var BUILD_DIR = path.resolve(__dirname, "build/public/");
if (process.env.NODE_ENV === "production") {
mode = "production";
BUILD_DIR = path.resolve(__dirname, "canapeapp/public/");
}
var SRC_DIR = path.resolve(__dirname, "frontend/js");
const config = {
mode: mode,
entry: path.join(SRC_DIR, "app.js"),
output: {
path: BUILD_DIR,