Skip to content

Commit 780afe5

Browse files
authored
fix(v2): typo in resolve.roots (#4212)
1 parent 0ac34b7 commit 780afe5

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/docusaurus/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const CONFIG_FILE_NAME = 'docusaurus.config.js';
1111
export const GENERATED_FILES_DIR_NAME = '.docusaurus';
1212
export const SRC_DIR_NAME = 'src';
1313
export const STATIC_DIR_NAME = 'static';
14-
export const STATIC_ASSETS_DIR_NAME = 'assets'; // files handled by webpack
14+
export const OUTPUT_STATIC_ASSETS_DIR_NAME = 'assets'; // files handled by webpack, hashed (can be cached aggressively)
1515
export const THEME_PATH = `${SRC_DIR_NAME}/theme`;
1616
export const DEFAULT_PORT = 3000;
1717
export const DEFAULT_PLUGIN_ID = 'default';

packages/docusaurus/src/webpack/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
getCustomBabelConfigFilePath,
2020
getMinimizer,
2121
} from './utils';
22-
import {STATIC_ASSETS_DIR_NAME} from '../constants';
22+
import {STATIC_DIR_NAME} from '../constants';
2323

2424
const CSS_REGEX = /\.css$/;
2525
const CSS_MODULE_REGEX = /\.module\.css$/;
@@ -96,7 +96,7 @@ export function createBaseConfig(
9696
// Allow resolution of url("/fonts/xyz.ttf") by webpack
9797
// See https://webpack.js.org/configuration/resolve/#resolveroots
9898
// See https://github.com/webpack-contrib/css-loader/issues/1256
99-
path.join(siteDir, STATIC_ASSETS_DIR_NAME),
99+
path.join(siteDir, STATIC_DIR_NAME),
100100
siteDir,
101101
process.cwd(),
102102
],

packages/docusaurus/src/webpack/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ import {TransformOptions} from '@babel/core';
2626
import {ConfigureWebpackFn, ConfigurePostCssFn} from '@docusaurus/types';
2727
import CssNanoPreset from '@docusaurus/cssnano-preset';
2828
import {version as cacheLoaderVersion} from 'cache-loader/package.json';
29-
import {BABEL_CONFIG_FILE_NAME, STATIC_ASSETS_DIR_NAME} from '../constants';
29+
import {
30+
BABEL_CONFIG_FILE_NAME,
31+
OUTPUT_STATIC_ASSETS_DIR_NAME,
32+
} from '../constants';
3033

3134
// Utility method to get style loaders
3235
export function getStyleLoaders(
@@ -275,7 +278,7 @@ export function getFileLoaderUtils(): Record<string, any> {
275278

276279
// defines the path/pattern of the assets handled by webpack
277280
const fileLoaderFileName = (folder: AssetFolder) =>
278-
`${STATIC_ASSETS_DIR_NAME}/${folder}/[name]-[hash].[ext]`;
281+
`${OUTPUT_STATIC_ASSETS_DIR_NAME}/${folder}/[name]-[hash].[ext]`;
279282

280283
const loaders = {
281284
file: (options: {folder: AssetFolder}) => {

0 commit comments

Comments
 (0)