AzuraCast/frontend/webpack.config.js

144 lines
5.5 KiB
JavaScript
Raw Normal View History

const webpack = require('webpack');
const WebpackAssetsManifest = require('webpack-assets-manifest');
2021-10-08 11:30:03 +00:00
const {VueLoaderPlugin} = require('vue-loader');
const path = require('path');
module.exports = {
2021-10-08 11:30:03 +00:00
mode: (process.env.NODE_ENV === 'production') ? 'production' : 'development',
entry: {
Account: '~/pages/Account.js',
2021-10-08 11:30:03 +00:00
Dashboard: '~/pages/Dashboard.js',
2021-11-03 21:07:05 +00:00
AdminApiKeys: '~/pages/Admin/ApiKeys.js',
2021-10-08 11:30:03 +00:00
AdminAuditLog: '~/pages/Admin/AuditLog.js',
AdminBackups: '~/pages/Admin/Backups.js',
2021-10-08 11:30:03 +00:00
AdminBranding: '~/pages/Admin/Branding.js',
AdminCustomFields: '~/pages/Admin/CustomFields.js',
AdminGeoLite: '~/pages/Admin/GeoLite.js',
AdminIndex: '~/pages/Admin/Index.js',
2022-06-19 22:28:31 +00:00
AdminLogs: '~/pages/Admin/Logs.js',
2021-10-08 11:30:03 +00:00
AdminPermissions: '~/pages/Admin/Permissions.js',
2021-10-11 09:55:25 +00:00
AdminSettings: '~/pages/Admin/Settings.js',
AdminShoutcast: '~/pages/Admin/Shoutcast.js',
AdminStereoTool: '~/pages/Admin/StereoTool.js',
AdminStations: '~/pages/Admin/Stations.js',
2021-10-08 11:30:03 +00:00
AdminStorageLocations: '~/pages/Admin/StorageLocations.js',
2021-10-27 23:15:33 +00:00
AdminUsers: '~/pages/Admin/Users.js',
2021-10-08 11:30:03 +00:00
PublicFullPlayer: '~/pages/Public/FullPlayer.js',
PublicHistory: '~/pages/Public/History.js',
PublicOnDemand: '~/pages/Public/OnDemand.js',
PublicPlayer: '~/pages/Public/Player.js',
PublicRequests: '~/pages/Public/Requests.js',
PublicSchedule: '~/pages/Public/Schedule.js',
PublicWebDJ: '~/pages/Public/WebDJ.js',
Recover: '~/pages/Recover.js',
SetupRegister: '~/pages/Setup/Register.js',
2021-10-11 09:55:25 +00:00
SetupSettings: '~/pages/Setup/Settings.js',
SetupStation: '~/pages/Setup/Station.js',
StationsBulkMedia: '~/pages/Stations/BulkMedia.js',
StationsFallback: '~/pages/Stations/Fallback.js',
2022-06-30 22:09:38 +00:00
StationsLogs: '~/pages/Stations/Logs.js',
StationsHlsStreams: '~/pages/Stations/HlsStreams.js',
StationsLiquidsoapConfig: '~/pages/Stations/LiquidsoapConfig.js',
2021-10-08 11:30:03 +00:00
StationsMedia: '~/pages/Stations/Media.js',
StationsMounts: '~/pages/Stations/Mounts.js',
StationsPlaylists: '~/pages/Stations/Playlists.js',
StationsPodcasts: '~/pages/Stations/Podcasts.js',
StationsProfile: '~/pages/Stations/Profile.js',
StationsProfileEdit: '~/pages/Stations/ProfileEdit.js',
2021-10-08 11:30:03 +00:00
StationsQueue: '~/pages/Stations/Queue.js',
StationsRemotes: '~/pages/Stations/Remotes.js',
StationsStereoToolConfig: '~/pages/Stations/StereoToolConfig.js',
2021-10-08 11:30:03 +00:00
StationsStreamers: '~/pages/Stations/Streamers.js',
StationsReportsListeners: '~/pages/Stations/Reports/Listeners.js',
StationsReportsRequests: '~/pages/Stations/Reports/Requests.js',
StationsReportsOverview: '~/pages/Stations/Reports/Overview.js',
2021-11-04 17:35:13 +00:00
StationsReportsSoundExchange: '~/pages/Stations/Reports/SoundExchange.js',
2021-10-08 11:30:03 +00:00
StationsReportsTimeline: '~/pages/Stations/Reports/Timeline.js',
StationsSftpUsers: '~/pages/Stations/SftpUsers.js',
StationsWebhooks: '~/pages/Stations/Webhooks.js'
},
2021-10-08 11:30:03 +00:00
resolve: {
enforceExtension: false,
alias: {
'~': path.resolve(__dirname, './vue')
},
2021-10-08 11:30:03 +00:00
extensions: ['.js', '.vue', '.json']
},
output: {
path: path.resolve(__dirname, '../web/static/webpack_dist'),
publicPath: '/static/webpack_dist/',
filename: '[name].[contenthash].js',
sourceMapFilename: '[name].[contenthash].map',
library: '[name]',
assetModuleFilename: 'images/[contenthash][ext]'
},
optimization: {
splitChunks: {
cacheGroups: {
translations: {
test: /translations\.json$/,
chunks: 'all',
enforce: true,
name: 'translations'
},
vendor: {
test: /[\\/]node_modules[\\/]/,
chunks: 'all',
enforce: true,
name(module) {
// get the name. E.g. node_modules/packageName/not/this/part.js
// or node_modules/packageName
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
2021-09-12 07:46:36 +00:00
2021-10-08 11:30:03 +00:00
// npm package names are URL-safe, but some servers don't like @ symbols
return `vendor-${packageName.replace('@', '')}`;
}
}
}
}
2021-10-08 11:30:03 +00:00
},
module: {
rules: [
{
test: /\.vue$/i,
use: [
'vue-loader'
]
},
{
test: /\.scss$/i,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
},
{
test: /\.css$/i,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
type: 'asset/resource'
}
]
2021-10-08 11:30:03 +00:00
},
plugins: [
new WebpackAssetsManifest({
output: path.resolve(__dirname, '../web/static/webpack.json'),
writeToDisk: true,
merge: true,
publicPath: true,
entrypoints: true
}),
new VueLoaderPlugin()
],
target: 'web',
performance: {
hints: false
}
};