2024-05-20 20:07:17 +03:00
|
|
|
const { generateWebpackConfig, merge } = require('shakapacker')
|
2023-05-21 17:59:36 +03:00
|
|
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
|
|
|
const { VueLoaderPlugin } = require('vue-loader')
|
|
|
|
|
|
2024-05-20 20:07:17 +03:00
|
|
|
const configs = generateWebpackConfig({
|
2023-05-21 17:59:36 +03:00
|
|
|
resolve: {
|
|
|
|
|
extensions: ['.css', '.scss', '.vue']
|
|
|
|
|
},
|
2023-06-24 18:31:12 +03:00
|
|
|
performance: {
|
|
|
|
|
maxEntrypointSize: 0
|
|
|
|
|
},
|
2023-05-21 17:59:36 +03:00
|
|
|
optimization: {
|
|
|
|
|
runtimeChunk: false,
|
2024-10-12 00:18:55 +03:00
|
|
|
concatenateModules: !process.env.BUNDLE_ANALYZE,
|
2023-05-21 17:59:36 +03:00
|
|
|
splitChunks: {
|
2024-05-23 11:50:14 +03:00
|
|
|
chunks (chunk) {
|
2026-02-12 09:22:08 +02:00
|
|
|
return chunk.name !== 'rollbar' && chunk.name !== 'dynamic-editor'
|
2024-05-23 11:50:14 +03:00
|
|
|
},
|
2023-05-21 17:59:36 +03:00
|
|
|
cacheGroups: {
|
2023-06-24 18:31:12 +03:00
|
|
|
default: false,
|
|
|
|
|
applicationVendors: {
|
|
|
|
|
test: /\/node_modules\//,
|
|
|
|
|
chunks: chunk => chunk.name === 'application'
|
|
|
|
|
},
|
2024-06-02 14:50:37 +03:00
|
|
|
drawVendors: {
|
|
|
|
|
test: /\/node_modules\//,
|
|
|
|
|
chunks: chunk => chunk.name === 'draw'
|
|
|
|
|
},
|
2023-06-24 18:31:12 +03:00
|
|
|
formVendors: {
|
|
|
|
|
test: /\/node_modules\//,
|
|
|
|
|
chunks: chunk => chunk.name === 'form'
|
|
|
|
|
}
|
2023-05-21 17:59:36 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
process.env.BUNDLE_ANALYZE && new BundleAnalyzerPlugin(),
|
|
|
|
|
new VueLoaderPlugin()
|
|
|
|
|
].filter(Boolean)
|
|
|
|
|
})
|
|
|
|
|
|
2026-02-12 09:22:08 +02:00
|
|
|
configs.module.rules[3].exclude = /dynamic_styles\.scss$/
|
|
|
|
|
|
2023-05-21 17:59:36 +03:00
|
|
|
configs.module = merge({
|
|
|
|
|
rules: [
|
2026-02-12 09:22:08 +02:00
|
|
|
{
|
|
|
|
|
test: /dynamic_styles\.scss$/,
|
|
|
|
|
use: ['css-loader', 'postcss-loader', 'sass-loader']
|
|
|
|
|
},
|
2023-05-21 17:59:36 +03:00
|
|
|
{
|
|
|
|
|
test: /\.vue$/,
|
|
|
|
|
use: [{
|
|
|
|
|
loader: 'vue-loader',
|
|
|
|
|
options: {
|
|
|
|
|
compilerOptions: {
|
|
|
|
|
isCustomElement: tag => tag.includes('-')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, configs.module)
|
|
|
|
|
|
|
|
|
|
module.exports = configs
|