Skip to content

Commit

Permalink
add react-router-dom cdn webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Mar 26, 2024
1 parent 0ce00f0 commit 91534b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions media_commons_booking_app/src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import SelectRoomPage from './routes/booking/formPages/SelectRoomPage';
import UserRolePage from './routes/booking/formPages/UserRolePage';
import UserSectionPage from './routes/booking/formPages/UserSectionPage';

console.log('TEST IN INDEX.JS');

const router = createHashRouter([
{
path: '/',
Expand Down
9 changes: 8 additions & 1 deletion media_commons_booking_app/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ const DynamicCdnWebpackPluginConfig = {
version: packageVersion,
url: `https://unpkg.com/@types/react@${packageVersion}/index.d.ts`,
};
case 'react-router-dom':
return {
name: packageName,
var: 'ReactRouterDOM',
version: packageVersion,
url: `https://cdnjs.cloudflare.com/ajax/libs/react-router-dom/${packageVersion}/react-router-dom.production.min.js`,
};
// return defaults/null depending if Dynamic CDN plugin finds package
default:
return moduleDetails;
Expand All @@ -267,7 +274,7 @@ const clientConfigs = clientEntrypoints.map((clientEntrypoint) => {
}),
new HtmlWebpackPlugin({
template: clientEntrypoint.template,
filename: `${clientEntrypoint.filename}.html`,
filename: `${clientEntrypoint.filename}${isProd ? '' : '-impl'}.html`,
inlineSource: '^/.*(js|css)$', // embed all js and css inline, exclude packages from dynamic cdn insertion
scriptLoading: 'blocking',
inject: 'body',
Expand Down

0 comments on commit 91534b4

Please sign in to comment.