2019-06-25 18:27:04 +00:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2019-05-08 18:27:07 +00:00
|
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
|
|
|
const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin");
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const path = require('path');
|
|
|
|
|
2019-07-25 07:58:34 +00:00
|
|
|
module.exports = (env, argv) => {
|
|
|
|
let mode = "development";
|
|
|
|
if (argv && argv.mode) {
|
|
|
|
mode = argv.mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log(`Building ${mode}...`);
|
|
|
|
|
|
|
|
return {
|
2019-09-05 03:16:44 +00:00
|
|
|
entry: path.resolve(__dirname, "www/index.js"),
|
2019-07-25 07:58:34 +00:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
|
|
|
filename: "index.js",
|
|
|
|
},
|
|
|
|
mode: mode,
|
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new CopyWebpackPlugin([{
|
|
|
|
from: path.resolve(__dirname, "www/index.html"),
|
|
|
|
to: "index.html"
|
|
|
|
}]),
|
|
|
|
new WasmPackPlugin({
|
|
|
|
crateDirectory: path.resolve(__dirname, ".."),
|
|
|
|
extraArgs: "--out-name=ruffle",
|
|
|
|
forceMode: mode,
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|
2019-05-08 18:27:07 +00:00
|
|
|
};
|