2020-05-17 10:03:54 +00:00
|
|
|
/* eslint-env node */
|
|
|
|
|
|
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
|
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
module.exports = (env, argv) => {
|
|
|
|
let mode = "production";
|
|
|
|
if (argv && argv.mode) {
|
|
|
|
mode = argv.mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(`Building ${mode}...`);
|
|
|
|
|
|
|
|
return {
|
2020-05-17 12:13:17 +00:00
|
|
|
entry: path.resolve(__dirname, "index.js"),
|
2020-05-17 10:03:54 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
filename: "ruffle.js",
|
|
|
|
chunkFilename: "core.ruffle.[contenthash].js",
|
|
|
|
jsonpFunction: "RufflePlayerLoader",
|
|
|
|
},
|
|
|
|
mode: mode,
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new WasmPackPlugin({
|
|
|
|
crateDirectory: path.resolve(__dirname, "../.."),
|
|
|
|
outName: "ruffle",
|
|
|
|
forceMode: mode,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
};
|
|
|
|
};
|