Skip to content

Commit

Permalink
feat(v2): Cache hashed assets to dedicated folders (#3998)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Jan 5, 2021
1 parent 6cb99bf commit f48d435
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/docusaurus/src/webpack/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ export function createBaseConfig(
futureEmitAssets: true,
pathinfo: false,
path: outDir,
filename: isProd ? '[name].[contenthash:8].js' : '[name].js',
chunkFilename: isProd ? '[name].[contenthash:8].js' : '[name].js',
filename: isProd ? 'assets/js/[name].[contenthash:8].js' : '[name].js',
chunkFilename: isProd
? 'assets/js/[name].[contenthash:8].js'
: '[name].js',
publicPath: baseUrl,
},
// Don't throw warning when asset created is over 250kb
Expand Down Expand Up @@ -188,8 +190,12 @@ export function createBaseConfig(
},
plugins: [
new MiniCssExtractPlugin({
filename: isProd ? '[name].[contenthash:8].css' : '[name].css',
chunkFilename: isProd ? '[name].[contenthash:8].css' : '[name].css',
filename: isProd
? 'assets/css/[name].[contenthash:8].css'
: '[name].css',
chunkFilename: isProd
? 'assets/css/[name].[contenthash:8].css'
: '[name].css',
// remove css order warnings if css imports are not sorted alphabetically
// see https://github.com/webpack-contrib/mini-css-extract-plugin/pull/422 for more reasoning
ignoreOrder: true,
Expand Down

0 comments on commit f48d435

Please sign in to comment.