Skip to content

Commit fb38ca5

Browse files
authored
Merge pull request #22 from bensmithett/update-deps
Upgrade dependencies
2 parents f8483d5 + 47ca082 commit fb38ca5

File tree

4 files changed

+2355
-2437
lines changed

4 files changed

+2355
-2437
lines changed

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.5.0
1+
14.15.4

app/build.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const path = require('path')
1010
const rimraf = require('rimraf')
1111
const chalk = require('chalk')
1212
const webpack = require('webpack')
13-
const ManifestPlugin = require('webpack-manifest-plugin')
13+
const { WebpackManifestPlugin } = require('webpack-manifest-plugin')
1414
const rehypeSlugPlugin = require('rehype-slug')
1515
const packageJSON = require('../package.json')
1616

@@ -26,15 +26,12 @@ const shared = {
2626
loader: 'babel-loader'
2727
},
2828

29-
// Transform static file imports into URL strings
30-
staticFiles: (mode) => ({
29+
// Transform static file imports into URL strings using Webpack 5 Asset Modules
30+
// https://webpack.js.org/guides/asset-modules/
31+
staticFiles: {
3132
test: /\.(png|jpe?g|gif|svg|woff2?|mp3|mp4|webm|webp)$/,
32-
loader: 'file-loader',
33-
options: {
34-
name: '[path][name].[contenthash].[ext]',
35-
publicPath: `${mode === 'production' ? packageJSON.tropical.siteURL : ''}/`
36-
}
37-
}),
33+
type: 'asset/resource'
34+
},
3835

3936
// Transform MDX files into React components.
4037
mdx: {
@@ -52,10 +49,11 @@ const shared = {
5249
}
5350
},
5451

55-
output: {
52+
output: (mode) => ({
5653
path: path.resolve(__dirname, '../output'),
57-
publicPath: '/'
58-
}
54+
publicPath: `${mode === 'production' ? packageJSON.tropical.siteURL : ''}/`,
55+
assetModuleFilename: 'assets/[name].[contenthash][ext]'
56+
})
5957
}
6058

6159
/*
@@ -70,16 +68,16 @@ const clientConfig = mode => {
7068
module: {
7169
rules: [
7270
shared.rules.js,
73-
shared.rules.staticFiles(mode),
71+
shared.rules.staticFiles,
7472
shared.rules.mdx
7573
]
7674
},
7775
output: {
78-
...shared.output,
76+
...shared.output(mode),
7977
filename: mode === 'production' ? '[name].bundle.[contenthash].js' : '[name].bundle.js'
8078
},
8179
plugins: [
82-
new ManifestPlugin({
80+
new WebpackManifestPlugin({
8381
fileName: 'manifest.client.json'
8482
})
8583
]
@@ -104,19 +102,19 @@ const prerenderConfig = (mode) => {
104102
module: {
105103
rules: [
106104
shared.rules.js,
107-
shared.rules.staticFiles(mode),
105+
shared.rules.staticFiles,
108106
shared.rules.mdx
109107
]
110108
},
111109
output: {
112-
...shared.output,
110+
...shared.output(mode),
113111
filename: '[name].bundle.js',
114112
libraryExport: 'default',
115113
libraryTarget: 'commonjs2',
116114
library: 'prerender'
117115
},
118116
plugins: [
119-
new ManifestPlugin({
117+
new WebpackManifestPlugin({
120118
fileName: 'manifest.prerender.json'
121119
})
122120
]
@@ -177,7 +175,7 @@ rimraf(path.resolve(__dirname, '../output/*'), err => {
177175
console.log(chalk.cyan('🏝 Clearing commonjs require cache...'))
178176
delete require.cache[require.resolve(prerenderModulePath)]
179177
console.log(chalk.cyan('🏝 Loading webpacked prerender module...'))
180-
const prerender = require(prerenderModulePath)
178+
const { prerender } = require(prerenderModulePath)
181179
console.log(chalk.cyan('🏝 Prerendering...'))
182180

183181
try {

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
"dayjs": "^1.8.31",
2222
"fela": "^11.1.2",
2323
"fela-dom": "^11.1.2",
24-
"file-loader": "^6.0.0",
2524
"prism-react-renderer": "^1.1.1",
26-
"react": "^16.12.0",
27-
"react-dom": "^16.12.0",
25+
"react": "^17.0.1",
26+
"react-dom": "^17.0.1",
2827
"react-fela": "^11.1.2",
2928
"react-helmet": "^6.0.0-beta.2",
3029
"rehype-slug": "^3.0.0",
3130
"rimraf": "^3.0.2",
3231
"serve": "^11.3.0",
33-
"webpack": "^4.41.6",
34-
"webpack-manifest-plugin": "^2.2.0"
32+
"webpack": "^5.21.2",
33+
"webpack-manifest-plugin": "^3.0.0"
3534
},
3635
"tropical": {
3736
"feedCollection": "posts",

0 commit comments

Comments
 (0)