Skip to content

Kitchensink code splitting improvements and upgrade to Looker components #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion react/typescript/kitchensink/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module.exports = {
},
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
filename: '[name].bundle.js',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting template

},
module: {
rules: [
Expand Down
19 changes: 19 additions & 0 deletions react/typescript/kitchensink/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,24 @@ module.exports = {
...commonConfig,
optimization: {
chunkIds: 'named',
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
// break out vendors into their own vendor bundles.
// looker gets special treatment as combined component
// package large.
const context = module.context.includes('/@looker/')
? module.context.replace('/@looker/', '/@looker-')
: module.context
const packageName = context.match(
/[\\/]node_modules[\\/](.*?)([\\/]|$)/
)[1]
return `vendor.${packageName.replace('@', '')}`
},
},
},
},
},
}