40 lines
877 B
JavaScript
40 lines
877 B
JavaScript
|
const path = require("path");
|
||
|
require("dotenv").config({
|
||
|
path: path.join(__dirname, ".env"),
|
||
|
});
|
||
|
const CopyPlugin = require("copy-webpack-plugin");
|
||
|
const EncryptPlugin = require("ricochet-js").EncryptPlugin;
|
||
|
|
||
|
const SECRET_KEY = process.env.RICOCHET_SECRET_KEY;
|
||
|
|
||
|
if (!SECRET_KEY) {
|
||
|
console.log("You must define a RICOCHET_SECRET_KEY env variable");
|
||
|
process.exit(-1);
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
entry: "./src/index.js",
|
||
|
target: "node",
|
||
|
devtool: false,
|
||
|
output: {
|
||
|
path: path.resolve(__dirname, "../public"),
|
||
|
filename: "setup.js",
|
||
|
library: "main",
|
||
|
libraryTarget: "var",
|
||
|
libraryExport: "default",
|
||
|
},
|
||
|
plugins: [
|
||
|
new CopyPlugin({
|
||
|
patterns: [
|
||
|
{
|
||
|
from: "**/*",
|
||
|
context: path.resolve(__dirname, "public"),
|
||
|
},
|
||
|
],
|
||
|
}),
|
||
|
new EncryptPlugin({
|
||
|
key: process.env.RICOCHET_SECRET_KEY,
|
||
|
}),
|
||
|
],
|
||
|
};
|