fix: dashboard build errors about API_URL/.env
This commit is contained in:
parent
4b63d03bdb
commit
4c21884016
3 changed files with 22 additions and 39 deletions
|
@ -1,9 +1,11 @@
|
|||
const path = require("path");
|
||||
const { VueLoaderPlugin } = require("vue-loader");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const DotenvPlugin = require("dotenv-webpack");
|
||||
const { merge } = require("webpack-merge");
|
||||
const webpack = require("webpack");
|
||||
const dotenv = require("dotenv");
|
||||
|
||||
dotenv.config({ path: path.resolve(process.cwd(), "../.env") });
|
||||
|
||||
const targetDir = path.normalize(path.join(__dirname, "dist"));
|
||||
|
||||
|
@ -12,6 +14,11 @@ if (!process.env.NODE_ENV) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!process.env.API_URL) {
|
||||
console.error("API_URL missing from environment variables");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const babelOpts = {
|
||||
presets: ["@babel/preset-env"],
|
||||
};
|
||||
|
@ -150,9 +157,6 @@ let config = {
|
|||
js: ["./src/main.ts"],
|
||||
},
|
||||
}),
|
||||
new DotenvPlugin({
|
||||
path: path.resolve(process.cwd(), "../.env"),
|
||||
}),
|
||||
new webpack.EnvironmentPlugin(["API_URL"]),
|
||||
],
|
||||
resolve: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue