refactored Markdown components to reduce bundle size
This commit is contained in:
parent
66e85ec63c
commit
8dc2a99926
16 changed files with 315 additions and 73 deletions
|
@ -1,17 +1,16 @@
|
|||
var webpack = require('webpack');
|
||||
var path = require("path");
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const highlightedLanguages = require('./static/js/constants/highlighted-languages.constant.json');
|
||||
|
||||
var config = {
|
||||
|
||||
let config = {
|
||||
entry: "./static/js/main.ts",
|
||||
output: {
|
||||
path: path.resolve(__dirname, "static/build"),
|
||||
filename: 'quay-frontend.js'
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".ts", ".tsx", ".js", ".scss"],
|
||||
alias: {
|
||||
sass: path.resolve(__dirname, 'static/css/directives/components/pages/')
|
||||
}
|
||||
extensions: [".ts", ".js"],
|
||||
},
|
||||
// Use global variables to maintain compatibility with non-Webpack components
|
||||
externals: {
|
||||
|
@ -48,6 +47,10 @@ var config = {
|
|||
angular: "angular",
|
||||
$: "jquery",
|
||||
}),
|
||||
// Whitelist highlight-supported languages (based on https://bjacobel.com/2016/12/04/highlight-bundle-size/)
|
||||
new webpack.ContextReplacementPlugin(
|
||||
/highlight\.js\/lib\/languages$/,
|
||||
new RegExp(`^./(${highlightedLanguages.join('|')})$`)),
|
||||
],
|
||||
devtool: "cheap-module-source-map",
|
||||
};
|
||||
|
|
Reference in a new issue