Skip to content

Commit

Permalink
fix: Retain index files in dist output to match declarations (#1665)
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn authored Jan 17, 2025
1 parent f10dbba commit 32fc4e3
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 76 deletions.
1 change: 1 addition & 0 deletions packages/next-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"eslint": "^9.11.1",
"eslint-config-molindo": "^8.0.0",
"eslint-plugin-react-compiler": "0.0.0-experimental-8e3b87c-20240822",
"glob": "^11.0.1",
"next": "^14.2.4",
"path-to-regexp": "^6.2.2",
"prettier": "^3.3.3",
Expand Down
10 changes: 9 additions & 1 deletion packages/next-intl/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import preserveDirectives from 'rollup-plugin-preserve-directives';
import {getBuildConfig} from 'tools';
import pkg from './package.json' with {type: 'json'};
import {glob} from 'glob';

function rewriteBundle(regex, replaceFn) {
return {
Expand Down Expand Up @@ -30,7 +31,14 @@ export default [
middleware: 'src/middleware.tsx',
routing: 'src/routing.tsx',
plugin: 'src/plugin.tsx',
config: 'src/config.tsx'
config: 'src/config.tsx',

// Workaround for https://github.com/rollup/rollup/issues/3916
// See https://x.com/jamannnnnn/status/1880199734280732841
...glob.sync('src/**/index.tsx').reduce((acc, file) => {
acc[file.replace('src/', '').replace('/index.tsx', '/index')] = file;
return acc;
}, {})
},
external: [
...Object.keys(pkg.dependencies),
Expand Down
Loading

0 comments on commit 32fc4e3

Please sign in to comment.