Revert "webpack: Use cache-loader for various loaders."

This reverts commit eb53b5e8de.

This appeared to not have the right logic yet for handling branch
switches.

See https://chat.zulip.org/#narrow/stream/3-backend/topic/frontend.20hot.20reloading/near/749259 for details.
This commit is contained in:
Tim Abbott 2019-06-03 22:10:47 -07:00
parent 9be6b79945
commit 5d0e144d62
2 changed files with 5 additions and 14 deletions

View File

@ -1,13 +1,6 @@
import { basename, resolve } from 'path';
import { basename } from 'path';
import { RuleSetRule } from 'webpack';
export const cacheLoader: RuleSetRule = {
loader: 'cache-loader',
options: {
cacheDirectory: resolve(__dirname, '../var/webpack-cache'),
},
};
/* Return imports-loader format to the config
For example:
[
@ -24,7 +17,7 @@ function getImportLoaders(optionsArr: ImportLoaderOptions[]): RuleSetRule[] {
for (var loaderEntry of optionsArr) {
importsLoaders.push({
test: require.resolve(loaderEntry.path),
use: [cacheLoader, "imports-loader?" + loaderEntry.args],
use: "imports-loader?" + loaderEntry.args,
});
}
return importsLoaders;
@ -51,7 +44,7 @@ function getExposeLoaders(optionsArr: ExportLoaderOptions[]): RuleSetRule[] {
for (var loaderEntry of optionsArr) {
const path = loaderEntry.path;
let name = "";
const useArr = [cacheLoader];
const useArr = [];
// If no name is provided, infer it
if (!loaderEntry.name) {
name = basename(path, '.js');

View File

@ -4,7 +4,7 @@ import * as webpack from 'webpack';
// The devServer member of webpack.Configuration is managed by the
// webpack-dev-server package. We are only importing the type here.
import * as _webpackDevServer from 'webpack-dev-server';
import { getExposeLoaders, getImportLoaders, cacheLoader } from './webpack-helpers';
import { getExposeLoaders, getImportLoaders } from './webpack-helpers';
import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
const assets = require('./webpack.assets.json');
@ -42,13 +42,12 @@ export default (env?: string): webpack.Configuration => {
{
// We dont want to match admin.js
test: /(\.min|min\.|zxcvbn)\.js/,
use: [cacheLoader, 'script-loader'],
use: ['script-loader'],
},
// regular css files
{
test: /\.css$/,
use: getHotCSS([
cacheLoader,
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
@ -62,7 +61,6 @@ export default (env?: string): webpack.Configuration => {
{
test: /\.(sass|scss)$/,
use: getHotCSS([
cacheLoader,
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',