2019-09-05 02:11:01 +00:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
|
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = (env, argv) => {
|
2019-10-08 01:25:17 +00:00
|
|
|
let mode = "production";
|
2019-09-05 02:11:01 +00:00
|
|
|
if (argv && argv.mode) {
|
|
|
|
mode = argv.mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(`Building ${mode}...`);
|
|
|
|
|
|
|
|
return {
|
2019-09-05 22:49:09 +00:00
|
|
|
entry: path.resolve(__dirname, "js/ruffle.js"),
|
2019-09-05 02:11:01 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
2019-09-05 22:49:09 +00:00
|
|
|
filename: "ruffle.js",
|
2020-01-16 19:59:58 +00:00
|
|
|
chunkFilename: "core.ruffle.[contenthash].js",
|
2019-10-08 01:25:17 +00:00
|
|
|
jsonpFunction: "RufflePlayerLoader",
|
2019-09-05 02:11:01 +00:00
|
|
|
},
|
|
|
|
mode: mode,
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new WasmPackPlugin({
|
|
|
|
crateDirectory: path.resolve(__dirname, ".."),
|
|
|
|
extraArgs: "--out-name=ruffle",
|
|
|
|
forceMode: mode,
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|