Skip to content
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

build: Vendor Split Popular Packages #3499

Merged
Merged
Changes from all commits
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
25 changes: 25 additions & 0 deletions vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,31 @@ export default defineConfig((config) => {
entryFileNames: 'assets/[name].[hash:22].js',
chunkFileNames: 'assets/[name].[hash:22].js',
assetFileNames: 'assets/[name].[hash:22][extname]',
manualChunks: {
vendor_react: ['react', 'react-dom', 'react/jsx-runtime'],
vendor_react_router: [
'react-router',
'react-router-dom',
'react-router-dom-v5-compat',
],
vendor_date_fns: ['date-fns'],
vendor_lodash: [
'lodash/get',
'lodash/isEqual',
'lodash/isNull',
'lodash/isNil',
'lodash/isEmpty',
'lodash/isString',
'lodash/isNumber',
'lodash/isBoolean',
'lodash/isUndefined',
'lodash/isArray',
'lodash/gt',
'lodash/omit',
'lodash/flatMap',
'lodash/groupBy',
],
Comment on lines +79 to +94
Copy link
Contributor

Choose a reason for hiding this comment

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

would we be able to leverage the use of ['lodash'] from https://rollupjs.org/configuration-options/#output-manualchunks so that we don't need to list each individual function one by one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I attempted that, however it did not work and included everything. I think mainly because we're not using @rollup/plugin-node-resolve we're using whatever is built into Vite

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for checking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wanted to double double check, tried using that plugin and it did not work, so we're stuck with this 😢

},
},
},
},
Expand Down