airboardgame/backend/webpack.common.js

41 lines
891 B
JavaScript
Raw Normal View History

import path from "path";
import dotenv from "dotenv";
import Dotenv from "dotenv-webpack";
import EncryptPlugin from "ricochetjs/encrypt-webpack-plugin";
import { fileURLToPath } from "url";
const dirname = path.dirname(fileURLToPath(import.meta.url));
dotenv.config({
path: path.join(dirname, ".env"),
2020-12-11 20:24:33 +01:00
});
const SECRET_KEY = process.env.RICOCHET_SITE_KEY;
2020-12-11 20:24:33 +01:00
if (!SECRET_KEY) {
console.log(
"You must define a RICOCHET_SITE_KEY env variable.\n" +
"If you don't have any key, please visit the Ricochet.js admin panel to create one."
);
2020-12-11 20:24:33 +01:00
process.exit(-1);
}
export default {
2020-12-11 20:24:33 +01:00
entry: "./src/index.js",
target: "node",
devtool: false,
output: {
path: path.resolve(dirname, "../public"),
filename: "ricochet.json",
2021-05-07 14:13:08 +02:00
library: {
type: "commonjs2",
2021-05-07 14:13:08 +02:00
},
2020-12-11 20:24:33 +01:00
},
plugins: [
2021-05-07 14:13:08 +02:00
new Dotenv(),
2020-12-11 20:24:33 +01:00
new EncryptPlugin({
key: SECRET_KEY,
2020-12-11 20:24:33 +01:00
}),
],
};