Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Jan 8, 2023
1 parent 7bcfeb0 commit 3e53256
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/install/config/webpacker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Note: You must restart bin/webpacker-dev-server for changes to take effect
# Note: You must restart bin/webpacker-dev-server for changes to take effect.
# This file contains the defaults used by webpacker.

default: &default
source_path: app/javascript
Expand Down Expand Up @@ -43,6 +44,11 @@ default: &default
# Select whether the compiler will use SHA digest ('digest' option) or most most recent modified timestamp ('mtime') to determine freshness
compiler_strategy: digest

# Select whether the compiler will always use a content hash and not just in production
# Don't use contentHash except for production for performance
# https://webpack.js.org/guides/build-performance/#avoid-production-specific-tooling
useContentHash: false

development:
<<: *default
compile: true
Expand Down Expand Up @@ -100,5 +106,8 @@ production:
# Production depends on precompilation of packs prior to booting for performance.
compile: false

# Use content hash for naming assets. Cannot be overridden by for production.
useContentHash: true

# Cache manifest.json for performance
cache_manifest: true
8 changes: 6 additions & 2 deletions package/environments/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ const getModulePaths = () => {
return result
}

console.log("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ");
console.log("config.useContentHash: " + config.useContentHash);
console.log("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ");

const getPlugins = () => {
const plugins = [
new webpack.EnvironmentPlugin(process.env),
Expand All @@ -68,7 +72,7 @@ const getPlugins = () => {
]

if (moduleExists('css-loader') && moduleExists('mini-css-extract-plugin')) {
const hash = isProduction ? '-[contenthash:8]' : ''
const hash = config.useContentHash ? '-[contenthash:8]' : ''
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
plugins.push(
new MiniCssExtractPlugin({
Expand All @@ -87,7 +91,7 @@ const getPlugins = () => {

// Don't use contentHash except for production for performance
// https://webpack.js.org/guides/build-performance/#avoid-production-specific-tooling
const hash = isProduction ? '-[contenthash]' : ''
const hash = config.useContentHash ? '-[contenthash]' : ''
module.exports = {
mode: 'production',
output: {
Expand Down

0 comments on commit 3e53256

Please sign in to comment.