1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-28 05:15:54 +00:00
FrankerFaceZ/webpack.common.js
SirStendec 929d669e1d Use the webpack externals configuration directive to prevent bundling any additional copies of Vue. This is basically to make sure the main menu doesn't misbehave.
Modules using vue may need to add the vue module to their load_requires now, as demonstrated in main_menu. If importing .vue files individually, this likely isn't necessary.
2018-04-05 15:44:47 -04:00

84 lines
No EOL
1.5 KiB
JavaScript

const webpack = require('webpack');
const path = require('path');
/* global module __dirname */
module.exports = {
entry: {
avalon: './src/main.js'
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
res: path.resolve(__dirname, 'res/'),
styles: path.resolve(__dirname, 'styles/'),
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'
},
plugins: [
new webpack.ExtendedAPIPlugin()
],
module: {
rules: [{
test: /\.s?css$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].css'
}
}, {
loader: 'extract-loader'
}, {
loader: 'css-loader',
options: {
sourceMap: true
}
}, {
loader: 'sass-loader',
options: {
sourceMap: true
}
}]
},
{
test: /\.jsx$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
},
{
test: /\.(?:eot|ttf|woff|woff2)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]'
}
}]
},
{
test: /\.svg$/,
loader: 'raw-loader'
},
{
test: /\.vue$/,
loader: 'vue-loader'
}]
}
}