website-gemompel/webpack.config.js

109 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-03-30 10:19:54 +00:00
var theme = '../themes/MetroMumbleLight'
var path = require('path');
2016-11-27 16:43:59 +00:00
module.exports = {
mode: 'development',
entry: {
index: [
'./app/index.js',
'./app/index.html'
],
2020-03-30 10:30:07 +00:00
config: './app/config.js',
theme: './app/theme.js',
matrix: './app/matrix.js'
},
devtool: "cheap-source-map",
2016-11-27 16:43:59 +00:00
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js'
2016-11-27 16:43:59 +00:00
},
module: {
rules: [
2016-11-27 16:43:59 +00:00
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: ['@babel/plugin-transform-runtime']
}
2016-11-27 16:43:59 +00:00
}
},
{
test: /\.html$/,
use: [
2020-03-30 10:19:54 +00:00
{
loader: 'file-loader',
options: { 'name': '[name].[ext]' }
},
{
loader: "extract-loader"
},
{
loader: 'html-loader',
options: {
attrs: ['img:src', 'link:href'],
root: theme
}
}
2016-11-27 16:43:59 +00:00
]
},
{
test: /\.css$/,
use: [
2016-11-27 16:43:59 +00:00
'file-loader',
'extract-loader',
'css-loader'
]
},
2020-03-30 10:30:07 +00:00
{
test: /\.scss$/,
use: [
'file-loader?name=[hash].css',
'extract-loader',
'css-loader',
'sass-loader'
]
},
2016-11-27 16:43:59 +00:00
{
2020-03-30 10:19:54 +00:00
type: 'javascript/auto',
2016-11-27 16:43:59 +00:00
test: /manifest\.json$|\.xml$/,
use: [
2016-11-27 16:43:59 +00:00
'file-loader',
'extract-loader',
2020-03-30 10:19:54 +00:00
{
loader: 'regexp-replace-loader',
options: {
match: {
pattern: "#require\\('([^']*)'\\)",
flags: 'g'
},
replaceWith: '"+require("$1")+"'
}
},
2016-11-27 16:43:59 +00:00
'raw-loader'
]
},
{
test: /\.(svg|png|ico)$/,
use: [
'file-loader'
]
2016-11-27 16:43:59 +00:00
},
{
test: /worker\.js$/,
use: { loader: 'worker-loader' }
},
2016-11-27 16:43:59 +00:00
{
enforce: 'post',
test: /mumble-streams\/lib\/data.js/,
use: [
'transform-loader?brfs'
]
2016-11-27 16:43:59 +00:00
}
]
},
target: 'web'
2016-11-27 16:43:59 +00:00
}