2020-12-11 20:24:33 +01:00
|
|
|
const path = require("path");
|
|
|
|
require("dotenv").config({
|
|
|
|
path: path.join(__dirname, ".env"),
|
|
|
|
});
|
2021-11-14 20:56:10 +01:00
|
|
|
const EncryptPlugin = require("ricochetjs").EncryptPlugin;
|
2021-05-07 14:13:08 +02:00
|
|
|
const Dotenv = require("dotenv-webpack");
|
2021-11-14 20:56:10 +01:00
|
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
2020-12-11 20:24:33 +01:00
|
|
|
|
2021-11-14 20:56:10 +01:00
|
|
|
const SECRET_KEY = process.env.RICOCHET_SITE_KEY;
|
2020-12-11 20:24:33 +01:00
|
|
|
|
|
|
|
if (!SECRET_KEY) {
|
2021-11-14 20:56:10 +01:00
|
|
|
console.log("You must define a RICOCHET_SITE_KEY env variable");
|
2020-12-11 20:24:33 +01:00
|
|
|
process.exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: "./src/index.js",
|
|
|
|
target: "node",
|
|
|
|
devtool: false,
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "../public"),
|
2021-11-14 20:56:10 +01:00
|
|
|
filename: "ricochet.json",
|
2021-05-07 14:13:08 +02:00
|
|
|
library: {
|
|
|
|
type: "commonjs",
|
|
|
|
},
|
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 CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: "**/*",
|
|
|
|
context: path.resolve(__dirname, "public"),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
new EncryptPlugin({
|
2021-11-14 20:56:10 +01:00
|
|
|
key: SECRET_KEY,
|
2020-12-11 20:24:33 +01:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|