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 014eb203c3 The Great Webpack Update.
* Update to version 4 of webpack.
* For that matter, update *every dependency* to the latest available version.
* Remove the babel build target for Edge, as it doesn't seem to be necessary with webpack 4 and tenser.
* Add support for optional chaining and nullish coalescing via Babel transformations.
* Update the clips domain version to work better. Or at all, really.
* Remove unused code from i18n.
* Remove the last `<style>` from vue component files. They don't work that way now anyways.
* Fix a bug in Raven's report handler.
* Fix a bug with the menu button in browsers that don't understand `:scope` within `querySelector()`.
2019-06-19 20:57:14 -04:00

127 lines
No EOL
2.3 KiB
JavaScript

const webpack = require('webpack');
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
/* global process module __dirname */
const PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = {
entry: {
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: {
cacheGroups: {
vendors: false
}
}
},
plugins: [
new VueLoaderPlugin(),
new webpack.ExtendedAPIPlugin()
],
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'
}]
}
}