1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00
FrankerFaceZ/webpack.common.js
SirStendec 264c375f13 4.20.61
This was a small update until Twitch ripped out half their CSS.

* Added: Cross-Origin Storage Bridge for settings, better synchronizing settings on sub-domains with support for binary blobs at the cost of slightly increased start-up time.
* Fixed: Rendering issues caused by missing CSS.
* Fixed: FFZ Control Center button not appearing on dashboard pages, and appearing in the incorrect place.
* Changed: Work towards splitting modules into their own JS files for a faster, more asynchronous startup.
* API Added: Methods for serializing and deserializing Blobs for transmission across postMessage.
2021-02-11 19:40:12 -05:00

140 lines
No EOL
2.8 KiB
JavaScript

const webpack = require('webpack');
const path = require('path');
const semver = require('semver');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
/* global process module __dirname */
const VERSION = semver.parse(require('./package.json').version);
const PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = {
entry: {
bridge: './src/bridge.js',
player: './src/player.js',
avalon: './src/main.js'
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
res: path.resolve(__dirname, 'res/'),
styles: path.resolve(__dirname, 'styles/'),
root: __dirname,
src: path.resolve(__dirname, 'src/'),
utilities: path.resolve(__dirname, 'src/utilities/')
}
},
externals: [
function(context, request, callback) {
if ( request === 'vue' && ! /utilities/.test(context) )
return callback(null, 'root ffzVue');
callback();
}
],
output: {
chunkFilename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'dist'),
jsonpFunction: 'ffzWebpackJsonp',
crossOriginLoading: 'anonymous'
},
optimization: {
splitChunks: {
chunks(chunk) {
return chunk.name !== 'avalon' && chunk.name !== 'bridge' && chunk.name !== 'player'
},
cacheGroups: {
vendors: false
}
}
},
plugins: [
new VueLoaderPlugin(),
new webpack.ExtendedAPIPlugin(),
new webpack.DefinePlugin({
__version_major__: VERSION.major,
__version_minor__: VERSION.minor,
__version_patch__: VERSION.patch,
__version_prerelease__: VERSION.prerelease
}),
],
module: {
rules: [{
test: /\.s?css$/,
use: [{
loader: 'file-loader',
options: {
name: PRODUCTION ? '[name].[hash].css' : '[name].css'
}
}, {
loader: 'extract-loader'
}, {
loader: 'css-loader',
options: {
sourceMap: true
}
}, {
loader: 'sass-loader',
options: {
sourceMap: true
}
}]
},
{
test: /\.json$/,
include: /src/,
type: 'javascript/auto',
loader: 'file-loader',
options: {
name: PRODUCTION ? '[name].[hash].json' : '[name].json'
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true
}
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
cacheDirectory: true,
plugins: [
['@babel/plugin-transform-react-jsx', {
pragma: 'createElement'
}]
]
}
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
},
{
test: /\.(?:eot|ttf|woff|woff2)$/,
use: [{
loader: 'file-loader',
options: {
name: PRODUCTION ? '[name].[hash].[ext]' : '[name].[ext]'
}
}]
},
{
test: /\.md$/,
loader: 'raw-loader'
},
{
test: /\.svg$/,
loader: 'raw-loader'
},
{
test: /\.vue$/,
loader: 'vue-loader'
}]
}
}