Skip to content

Commit bb190e8

Browse files
committed
configure webpacker builder app to use output filenames without digests
#343 (comment)
1 parent f0383de commit bb190e8

17 files changed

+102
-72
lines changed

builder/config/webpack/environment.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
const { environment } = require('@rails/webpacker')
22

3+
// Remove the digest from the output js filename.
4+
// https://github.com/matestack/matestack-ui-core/issues/343#issuecomment-581149092
5+
//
6+
environment.config.set("output.filename", chunkData => {
7+
return "[name].js"
8+
})
9+
10+
// Remove the digest from the output css filename.
11+
// https://github.com/matestack/matestack-ui-core/issues/343#issuecomment-581149092
12+
//
13+
// Inspect with:
14+
//
15+
// console.log(environment.plugins)
16+
//
17+
const miniCssExtractPlugin = environment.plugins.get('MiniCssExtract')
18+
miniCssExtractPlugin.options.filename = "[name].css"
19+
320
module.exports = environment

builder/config/webpack/production.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
22

33
const environment = require('./environment')
44

5+
// Add `.min` to the production versions of the output files.
6+
// https://github.com/matestack/matestack-ui-core/issues/343#issuecomment-580246554
7+
// https://github.com/matestack/matestack-ui-core/issues/343#issuecomment-581149092
8+
//
9+
environment.config.set("output.filename", chunkData => {
10+
return "[name].min.js"
11+
})
12+
const miniCssExtractPlugin = environment.plugins.get('MiniCssExtract')
13+
miniCssExtractPlugin.options.filename = "[name].min.css"
14+
15+
516
module.exports = environment.toWebpackConfig()
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
{
22
"entrypoints": {
33
"matestack-ui-core": {
4+
"css": [
5+
"/dist/matestack-ui-core.css"
6+
],
47
"js": [
5-
"/vendor/assets/javascripts/dist/matestack-ui-core.min.js"
8+
"/dist/matestack-ui-core.js"
9+
],
10+
"css.map": [
11+
"/dist/matestack-ui-core.css.map"
612
],
713
"js.map": [
8-
"/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map"
14+
"/dist/matestack-ui-core.js.map"
915
]
1016
}
1117
},
12-
"matestack-ui-core.js": "/vendor/assets/javascripts/dist/matestack-ui-core.min.js",
13-
"matestack-ui-core.js.map": "/vendor/assets/javascripts/dist/matestack-ui-core.min.js.map"
18+
"matestack-ui-core.css": "/dist/matestack-ui-core.css",
19+
"matestack-ui-core.css.map": "/dist/matestack-ui-core.css.map",
20+
"matestack-ui-core.js": "/dist/matestack-ui-core.js",
21+
"matestack-ui-core.js.map": "/dist/matestack-ui-core.js.map"
1422
}
132 Bytes
Binary file not shown.
-8 Bytes
Binary file not shown.

vendor/assets/javascripts/dist/matestack-ui-core.css

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/assets/javascripts/dist/matestack-ui-core.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/assets/javascripts/dist/matestack-ui-core.js

Lines changed: 33 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/assets/javascripts/dist/matestack-ui-core.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
body{background:#00f}

0 commit comments

Comments
 (0)