Fix indentation of webpack config

pull/11892/head
Travis Ralston 2020-01-16 11:33:55 -07:00
parent 6ce50435e3
commit 69d49f9881
1 changed files with 25 additions and 25 deletions

View File

@ -17,14 +17,14 @@ module.exports = (env, argv) => {
return { return {
entry: { entry: {
"bundle": "./src/vector/index.js", "bundle": "./src/vector/index.js",
"indexeddb-worker": "./src/vector/indexeddb-worker.js", "indexeddb-worker": "./src/vector/indexeddb-worker.js",
"mobileguide": "./src/vector/mobile_guide/index.js", "mobileguide": "./src/vector/mobile_guide/index.js",
// CSS themes // CSS themes
"theme-light": "./node_modules/matrix-react-sdk/res/themes/light/css/light.scss", "theme-light": "./node_modules/matrix-react-sdk/res/themes/light/css/light.scss",
"theme-dark": "./node_modules/matrix-react-sdk/res/themes/dark/css/dark.scss", "theme-dark": "./node_modules/matrix-react-sdk/res/themes/dark/css/dark.scss",
"theme-light-custom": "./node_modules/matrix-react-sdk/res/themes/light-custom/css/light-custom.scss", "theme-light-custom": "./node_modules/matrix-react-sdk/res/themes/light-custom/css/light-custom.scss",
"theme-dark-custom": "./node_modules/matrix-react-sdk/res/themes/dark-custom/css/dark-custom.scss", "theme-dark-custom": "./node_modules/matrix-react-sdk/res/themes/dark-custom/css/dark-custom.scss",
}, },
optimization: { optimization: {
@ -35,8 +35,8 @@ module.exports = (env, argv) => {
cacheGroups: { cacheGroups: {
styles: { styles: {
name: 'styles', name: 'styles',
test: /\.css$/, test: /\.css$/,
enforce: true, enforce: true,
// Do not add `chunks: 'all'` here because you'll break the app entry point. // Do not add `chunks: 'all'` here because you'll break the app entry point.
}, },
}, },
@ -45,7 +45,7 @@ module.exports = (env, argv) => {
// Minification is normally enabled by default for webpack in production mode, but // Minification is normally enabled by default for webpack in production mode, but
// we use a CSS optimizer too and need to manage it ourselves. // we use a CSS optimizer too and need to manage it ourselves.
minimize: argv.mode === 'production', minimize: argv.mode === 'production',
minimizer: argv.mode === 'production' ? [new TerserPlugin({}), new OptimizeCSSAssetsPlugin({})] : [], minimizer: argv.mode === 'production' ? [new TerserPlugin({}), new OptimizeCSSAssetsPlugin({})] : [],
}, },
resolve: { resolve: {
@ -59,22 +59,22 @@ module.exports = (env, argv) => {
// layer to have our custom alternate fields to load things in the right order. These are // layer to have our custom alternate fields to load things in the right order. These are
// the defaults of webpack prepended with `matrix_src_`. // the defaults of webpack prepended with `matrix_src_`.
mainFields: ['matrix_src_browser', 'matrix_src_main', 'browser', 'main'], mainFields: ['matrix_src_browser', 'matrix_src_main', 'browser', 'main'],
aliasFields: ['matrix_src_browser', 'browser'], aliasFields: ['matrix_src_browser', 'browser'],
// We need to specify that TS can be resolved without an extension // We need to specify that TS can be resolved without an extension
extensions: ['.js', '.json', '.ts'], extensions: ['.js', '.json', '.ts'],
alias: { alias: {
// alias any requires to the react module to the one in our path, // alias any requires to the react module to the one in our path,
// otherwise we tend to get the react source included twice when // otherwise we tend to get the react source included twice when
// using `npm link` / `yarn link`. // using `npm link` / `yarn link`.
"react": path.resolve(__dirname, 'node_modules/react'), "react": path.resolve(__dirname, 'node_modules/react'),
"react-dom": path.resolve(__dirname, 'node_modules/react-dom'), "react-dom": path.resolve(__dirname, 'node_modules/react-dom'),
// same goes for js-sdk - we don't need two copies. // same goes for js-sdk - we don't need two copies.
"matrix-js-sdk": path.resolve(__dirname, 'node_modules/matrix-js-sdk'), "matrix-js-sdk": path.resolve(__dirname, 'node_modules/matrix-js-sdk'),
// Define a variable so the i18n stuff can load // Define a variable so the i18n stuff can load
"$webapp": path.resolve(__dirname, 'webapp'), "$webapp": path.resolve(__dirname, 'webapp'),
}, },
}, },
@ -99,7 +99,7 @@ module.exports = (env, argv) => {
exclude: /node_modules/, exclude: /node_modules/,
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
cacheDirectory: true, cacheDirectory: true
} }
}, },
{ {
@ -283,8 +283,8 @@ module.exports = (env, argv) => {
}), }),
], ],
output: { output: {
path: path.join(__dirname, "webapp"), path: path.join(__dirname, "webapp"),
// The generated JS (and CSS, from the extraction plugin) are put in a // The generated JS (and CSS, from the extraction plugin) are put in a
// unique subdirectory for the build. There will only be one such // unique subdirectory for the build. There will only be one such
@ -295,7 +295,7 @@ module.exports = (env, argv) => {
// chunks even after the app is redeployed. // chunks even after the app is redeployed.
filename: "bundles/[hash]/[name].js", filename: "bundles/[hash]/[name].js",
chunkFilename: "bundles/[hash]/[name].js", chunkFilename: "bundles/[hash]/[name].js",
}, },
// DO NOT enable this option. It makes the source maps all wonky. Instead, // DO NOT enable this option. It makes the source maps all wonky. Instead,
// we end up including the sourcemaps through the loaders which makes them // we end up including the sourcemaps through the loaders which makes them
@ -307,7 +307,7 @@ module.exports = (env, argv) => {
// serve unwebpacked assets from webapp. // serve unwebpacked assets from webapp.
contentBase: './webapp', contentBase: './webapp',
stats: { stats: {
// don't fill the console up with a mahoosive list of modules // don't fill the console up with a mahoosive list of modules
chunks: false, chunks: false,
}, },
@ -316,7 +316,7 @@ module.exports = (env, argv) => {
// so webpack-dev-server reloads the page on every update which is quite // so webpack-dev-server reloads the page on every update which is quite
// tedious in Riot since that can take a while. // tedious in Riot since that can take a while.
hot: false, hot: false,
inline: false, inline: false,
}, },
}; };
}; };