Skip to content

Commit

Permalink
Merge pull request #482 from commercelayer/fix/avoid-pruning-adyen-la…
Browse files Browse the repository at this point in the history
…nguages-not-used

Avoid pruning adyen supported languages
  • Loading branch information
malessani authored Sep 17, 2024
2 parents aa949aa + 9f5901f commit 8364277
Showing 1 changed file with 1 addition and 39 deletions.
40 changes: 1 addition & 39 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,7 @@ let nextConfig = {
distDir: "out/dist",
poweredByHeader: false,
swcMinify: false,
webpack: (config, { webpack }) => {
const AdyenWebExcludedLocales = new Set([
"cs-CZ",
"el-GR",
"hr-HR",
"ja-JP",
"ko-KR",
"ru-RU",
"zh-TW",
"zh-CN",
"ro-RO",
"sk-SK",
"pt-PT",
"pt-BR",
"sl-SI",
"fi-FI",
"ar",
"nl-NL",
"sv-SE",
"da-DK",
"no-NO",
])

const adyenIgnorePluginConfig = new webpack.IgnorePlugin({
checkResource(resource, context) {
if (!/@adyen\/adyen-web\/dist\/es/.test(context)) return false

// Extract the filename from the resource path
const parts = resource.split("/")
const filenameWithExtension = parts[parts.length - 1]

// Remove the file extension
const filename = filenameWithExtension.replace(/\.[^/.]+$/, "")

return AdyenWebExcludedLocales.has(filename)
},
})

config.plugins.push(adyenIgnorePluginConfig)
webpack: (config) => {
return config
},
// When when app is exported as SPA and served in a sub-folder
Expand Down

0 comments on commit 8364277

Please sign in to comment.