jellyfin-web/webpack.common.js

114 lines
3.0 KiB
JavaScript
Raw Normal View History

2020-05-04 03:44:12 -07:00
const path = require('path');
2020-08-15 03:44:52 -07:00
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
2020-08-16 11:24:45 -07:00
const CopyPlugin = require('copy-webpack-plugin');
2020-10-18 12:37:54 -07:00
const packageConfig = require('./package.json');
2020-05-29 14:32:45 -07:00
module.exports = {
2020-05-04 03:44:12 -07:00
context: path.resolve(__dirname, 'src'),
2020-08-15 03:44:52 -07:00
target: 'web',
resolve: {
modules: [
2020-05-04 03:44:12 -07:00
path.resolve(__dirname, 'node_modules')
]
2019-05-24 21:28:06 -07:00
},
2019-09-30 16:58:05 -07:00
plugins: [
2020-08-16 11:24:45 -07:00
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: 'themes/',
to: 'themes/'
2020-10-21 17:10:40 -07:00
},
{
from: 'assets/**',
globOptions: {
ignore: ['**/css/*']
}
},
{
from: '*.*',
globOptions: {
ignore: ['**.js', '**.html']
}
2020-08-16 11:24:45 -07:00
}
]
})
2020-08-15 03:44:52 -07:00
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
2020-10-18 07:29:40 -07:00
},
module: {
rules: [
2020-10-18 12:37:54 -07:00
{
test: /\.(html)$/,
use: {
loader: 'html-loader'
}
},
{
test: /\.js$/,
exclude: /node_modules[\\/](?!date-fns|epubjs)/,
use: [{
loader: 'babel-loader',
options: {
presets: packageConfig.babel.presets
}
}]
},
{
test: /\.s[ac]ss$/i,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
config: {
path: __dirname
}
}
},
'sass-loader'
]
},
2020-10-18 12:37:54 -07:00
{
test: /\.css$/i,
use: [
'style-loader',
'css-loader',
{
loader: 'postcss-loader',
options: {
config: {
path: __dirname
}
}
}
]
},
{
test: /\.(png|jpg|gif|svg)$/i,
use: ['file-loader']
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
'file-loader'
]
},
{
test: /\.(mp3)$/i,
use: ['file-loader']
},
2020-10-18 07:29:40 -07:00
{
test: require.resolve('jquery'),
loader: 'expose-loader',
options: {
exposes: ['$', 'jQuery']
}
}
]
2020-08-15 03:44:52 -07:00
}
};