Files
danbooru/config/webpack/base.js
evazion 55980c6fbf Add Ruffle support for Flash files.
Allow viewing Flash posts with the Ruffle emulator.

Known issues:

* Many flash files aren't fully supported.
* In development it sometimes spazzes out and starts triggering random
  keyboard shortcuts when you press any key. This doesn't happen with
  the browser extension.
* We have to put the .wasm file in the public/packs/js directory because
  Ruffle is hardcoded to search for it there.
* If you're running Nginx, you need to make sure you're serving the
  right MIME type for .wasm files or it won't work.
* We're using Some Random Guy's unofficial NPM package for Ruffle, since the
  Ruffle project doesn't publish an official package themselves. We
  should build our own package.

References:

* https://github.com/ruffle-rs/ruffle
* https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle#configure-webassembly-mime-type
* https://www.npmjs.com/package/ruffle-mirror
2021-03-31 20:20:22 -05:00

32 lines
623 B
JavaScript

const { webpackConfig, merge } = require('@rails/webpacker')
module.exports = merge(webpackConfig, {
output: {
library: "Danbooru",
},
resolve: {
alias: {
"jquery": "jquery/src/jquery.js",
"react": "preact/compat",
"react-dom": "preact/compat",
}
},
module: {
rules: [{
test: /.erb$/,
enforce: "pre",
exclude: /node_modules/,
loader: "rails-erb-loader",
options: {
runner: "bin/rails runner"
}
}, {
test: /\.wasm$/,
type: 'asset/resource',
generator: {
filename: 'js/[name][ext]'
}
}]
},
});