Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/config/webpack.config.development.js
Show All 12 Lines | |||||
const webpack = require('webpack'); | const webpack = require('webpack'); | ||||
const BundleTracker = require('webpack-bundle-tracker'); | const BundleTracker = require('webpack-bundle-tracker'); | ||||
const RobotstxtPlugin = require('robotstxt-webpack-plugin'); | const RobotstxtPlugin = require('robotstxt-webpack-plugin'); | ||||
const CleanWebpackPlugin = require('clean-webpack-plugin'); | const CleanWebpackPlugin = require('clean-webpack-plugin'); | ||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||||
const FixSwhSourceMapsPlugin = require('./webpack-plugins/fix-swh-source-maps-webpack-plugin'); | const FixSwhSourceMapsPlugin = require('./webpack-plugins/fix-swh-source-maps-webpack-plugin'); | ||||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||||
const GenerateWebLabelsPlugin = require('./webpack-plugins/generate-weblabels-webpack-plugin'); | const GenerateWebLabelsPlugin = require('./webpack-plugins/generate-weblabels-webpack-plugin'); | ||||
const loadedMathJaxJsFiles = require('./mathjax-js-files'); | |||||
// are we running webpack-dev-server ? | // are we running webpack-dev-server ? | ||||
const isDevServer = process.argv.find(v => v.includes('webpack-dev-server')); | const isDevServer = process.argv.find(v => v.includes('webpack-dev-server')); | ||||
// webpack-dev-server configuration | // webpack-dev-server configuration | ||||
const devServerPort = 3000; | const devServerPort = 3000; | ||||
const devServerPublicPath = 'http://localhost:' + devServerPort + '/static/'; | const devServerPublicPath = 'http://localhost:' + devServerPort + '/static/'; | ||||
// set publicPath according if we are using webpack-dev-server to serve | // set publicPath according if we are using webpack-dev-server to serve | ||||
// our assets or not | // our assets or not | ||||
▲ Show 20 Lines • Show All 335 Lines • ▼ Show 20 Lines | new GenerateWebLabelsPlugin({ | ||||
'./node_modules/admin-lte/dist/js/adminlte.js' | './node_modules/admin-lte/dist/js/adminlte.js' | ||||
}, | }, | ||||
licenseOverride: { | licenseOverride: { | ||||
'./swh/web/assets/src/thirdparty/jquery.tabSlideOut/jquery.tabSlideOut.js': { | './swh/web/assets/src/thirdparty/jquery.tabSlideOut/jquery.tabSlideOut.js': { | ||||
'spdxLicenseExpression': 'GPL-3.0', | 'spdxLicenseExpression': 'GPL-3.0', | ||||
'licenseFilePath': './swh/web/assets/src/thirdparty/jquery.tabSlideOut/LICENSE' | 'licenseFilePath': './swh/web/assets/src/thirdparty/jquery.tabSlideOut/LICENSE' | ||||
} | } | ||||
}, | }, | ||||
additionalScripts: { | additionalScripts: Object.assign( | ||||
{ | |||||
'js/pdf.worker.min.js': [ | 'js/pdf.worker.min.js': [ | ||||
{ | { | ||||
'id': 'pdfjs-dist/build/pdf.worker.js', | 'id': 'pdfjs-dist/build/pdf.worker.js', | ||||
'path': './node_modules/pdfjs-dist/build/pdf.worker.js', | 'path': './node_modules/pdfjs-dist/build/pdf.worker.js', | ||||
'spdxLicenseExpression': 'Apache-2.0', | 'spdxLicenseExpression': 'Apache-2.0', | ||||
'licenseFilePath': './node_modules/pdfjs-dist/LICENSE' | 'licenseFilePath': './node_modules/pdfjs-dist/LICENSE' | ||||
} | } | ||||
] | ] | ||||
} | }, | ||||
loadedMathJaxJsFiles | |||||
) | |||||
}) | }) | ||||
], | ], | ||||
// webpack optimizations | // webpack optimizations | ||||
optimization: { | optimization: { | ||||
// ensure the vendors bundle gets emitted in a single chunk | // ensure the vendors bundle gets emitted in a single chunk | ||||
splitChunks: { | splitChunks: { | ||||
cacheGroups: { | cacheGroups: { | ||||
vendors: { | vendors: { | ||||
Show All 13 Lines |