mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Merge tag 'dspace-7.4' into fully-qualified-sitemap-urls-7.4
This commit is contained in:
@@ -3,14 +3,37 @@ import { join } from 'path';
|
||||
import { buildAppConfig } from '../src/config/config.server';
|
||||
import { commonExports } from './webpack.common';
|
||||
|
||||
const CompressionPlugin = require('compression-webpack-plugin');
|
||||
const zlib = require('zlib');
|
||||
|
||||
module.exports = Object.assign({}, commonExports, {
|
||||
target: 'web',
|
||||
node: {
|
||||
module: 'empty'
|
||||
},
|
||||
plugins: [
|
||||
...commonExports.plugins,
|
||||
new CompressionPlugin({
|
||||
filename: '[path][base].gz',
|
||||
algorithm: 'gzip',
|
||||
test: /\.(js|css|html|svg|json5)$/,
|
||||
threshold: 10240,
|
||||
minRatio: 0.8,
|
||||
}),
|
||||
new CompressionPlugin({
|
||||
filename: '[path][base].br',
|
||||
algorithm: 'brotliCompress',
|
||||
test: /\.(js|css|html|svg|json5)$/,
|
||||
compressionOptions: {
|
||||
params: {
|
||||
[zlib.constants.BROTLI_PARAM_QUALITY]: 11,
|
||||
},
|
||||
},
|
||||
threshold: 10240,
|
||||
minRatio: 0.8,
|
||||
}),
|
||||
],
|
||||
devServer: {
|
||||
before(app, server) {
|
||||
setupMiddlewares(middlewares, server) {
|
||||
buildAppConfig(join(process.cwd(), 'src/assets/config.json'));
|
||||
return middlewares;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@@ -2,8 +2,7 @@ import { globalCSSImports, projectRoot } from './helpers';
|
||||
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ScriptExtPlugin = require('script-ext-html-webpack-plugin');
|
||||
const sass = require('sass');
|
||||
|
||||
export const copyWebpackOptions = {
|
||||
patterns: [
|
||||
@@ -20,11 +19,10 @@ export const copyWebpackOptions = {
|
||||
// replace(/\\/g, '/') because glob patterns need forward slashes, even on windows:
|
||||
// https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
|
||||
from: path.join(__dirname, '..', 'src', 'themes', '*', 'assets', '**', '*').replace(/\\/g, '/'),
|
||||
to: 'assets',
|
||||
noErrorOnMissing: true,
|
||||
transformPath(targetPath, absolutePath) {
|
||||
to({ absoluteFilename }) {
|
||||
// use [\/|\\] to match both POSIX and Windows separators
|
||||
const matches = absolutePath.match(/.*[\/|\\]themes[\/|\\]([^\/|^\\]+)[\/|\\]assets[\/|\\](.+)$/);
|
||||
const matches = absoluteFilename.match(/.*[\/|\\]themes[\/|\\]([^\/|^\\]+)[\/|\\]assets[\/|\\](.+)$/);
|
||||
if (matches) {
|
||||
// matches[1] is the theme name
|
||||
// matches[2] is the rest of the path relative to the assets folder
|
||||
@@ -40,16 +38,21 @@ export const copyWebpackOptions = {
|
||||
]
|
||||
};
|
||||
|
||||
const SCSS_LOADERS = [{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
},
|
||||
const SCSS_LOADERS = [
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
// sass >1.33 complains about deprecation warnings in Bootstrap 4
|
||||
// After upgrading to Angular 12 we need to explicitly use an older version here
|
||||
// todo: remove after upgrading to Bootstrap 5
|
||||
implementation: sass,
|
||||
sassOptions: {
|
||||
includePaths: [projectRoot('./')]
|
||||
}
|
||||
@@ -60,14 +63,6 @@ const SCSS_LOADERS = [{
|
||||
export const commonExports = {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin(copyWebpackOptions),
|
||||
new HtmlWebpackPlugin({
|
||||
template: projectRoot('./src/index.html', ),
|
||||
output: projectRoot('dist'),
|
||||
inject: 'head'
|
||||
}),
|
||||
new ScriptExtPlugin({
|
||||
defaultAttribute: 'defer'
|
||||
})
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
@@ -99,5 +94,8 @@ export const commonExports = {
|
||||
]
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
ignoreWarnings: [
|
||||
/src\/themes\/[^/]+\/.*theme.module.ts is part of the TypeScript compilation but it's unused/,
|
||||
]
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
@@ -10,19 +10,16 @@ module.exports = {
|
||||
path: path.resolve(__dirname, '..' , 'dist/iiif/mirador'),
|
||||
filename: '[name].js'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.html$/i,
|
||||
loader: 'html-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
devServer: {
|
||||
contentBase: '../dist/iiif/mirador',
|
||||
},
|
||||
plugins: [new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: './src/mirador-viewer/mirador.html'
|
||||
resolve: {
|
||||
fallback: {
|
||||
url: false
|
||||
}},
|
||||
plugins: [new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{from: './src/mirador-viewer/mirador.html', to: './index.html'}
|
||||
]
|
||||
})]
|
||||
};
|
||||
|
@@ -2,7 +2,4 @@ import { commonExports } from './webpack.common';
|
||||
|
||||
module.exports = Object.assign({}, commonExports, {
|
||||
target: 'web',
|
||||
node: {
|
||||
module: 'empty'
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user