Skip to content

build(rspack): Add back moment IgnorePlugin #92149

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

Merged
merged 1 commit into from
May 22, 2025
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
47 changes: 25 additions & 22 deletions rspack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,32 @@ const appConfig: Configuration = {
},
plugins: [
/**
* Adds build time measurement instrumentation, which will be reported back
* to sentry
* Without this, webpack will chunk the locales but attempt to load them all
* eagerly.
*/
// new SentryInstrumentation(),
Copy link
Member

Choose a reason for hiding this comment

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

If this was removed, we should remove the module in build-utils as well

Copy link
Member Author

Choose a reason for hiding this comment

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

its still in webpack, can do later

new rspack.IgnorePlugin({
contextRegExp: /moment$/,
resourceRegExp: /^\.\/locale$/,
}),

/**
* Restrict translation files that are pulled in through app/translations.jsx
* and through moment/locale/* to only those which we create bundles for via
* locale/catalogs.json.
*
* Without this, webpack will still output all of the unused locale files despite
* the application never loading any of them.
*/
new rspack.ContextReplacementPlugin(
/sentry-locale$/,
path.join(__dirname, 'src', 'sentry', 'locale', path.sep),
true,
new RegExp(`(${supportedLocales.join('|')})/.*\\.po$`)
),
new rspack.ContextReplacementPlugin(
/moment\/locale/,
new RegExp(`(${supportedLanguages.join('|')})\\.js$`)
),

/**
* TODO(epurkhiser): Figure out if we still need these
Expand Down Expand Up @@ -332,25 +354,6 @@ const appConfig: Configuration = {

...(SHOULD_ADD_RSDOCTOR ? [new RsdoctorWebpackPlugin({})] : []),

/**
* Restrict translation files that are pulled in through app/translations.jsx
* and through moment/locale/* to only those which we create bundles for via
* locale/catalogs.json.
*
* Without this, webpack will still output all of the unused locale files despite
* the application never loading any of them.
*/
new rspack.ContextReplacementPlugin(
/sentry-locale$/,
path.join(__dirname, 'src', 'sentry', 'locale', path.sep),
true,
new RegExp(`(${supportedLocales.join('|')})/.*\\.po$`)
),
new rspack.ContextReplacementPlugin(
/moment\/locale/,
new RegExp(`(${supportedLanguages.join('|')})\\.js$`)
),

/**
* Copies file logo-sentry.svg to the dist/entrypoints directory so that it can be accessed by
* the backend
Expand Down
Loading