Skip to content

Commit 32fc4e3

Browse files
authored
fix: Retain index files in dist output to match declarations (#1665)
1 parent f10dbba commit 32fc4e3

File tree

3 files changed

+85
-76
lines changed

3 files changed

+85
-76
lines changed

packages/next-intl/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
"eslint": "^9.11.1",
137137
"eslint-config-molindo": "^8.0.0",
138138
"eslint-plugin-react-compiler": "0.0.0-experimental-8e3b87c-20240822",
139+
"glob": "^11.0.1",
139140
"next": "^14.2.4",
140141
"path-to-regexp": "^6.2.2",
141142
"prettier": "^3.3.3",

packages/next-intl/rollup.config.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import preserveDirectives from 'rollup-plugin-preserve-directives';
22
import {getBuildConfig} from 'tools';
33
import pkg from './package.json' with {type: 'json'};
4+
import {glob} from 'glob';
45

56
function rewriteBundle(regex, replaceFn) {
67
return {
@@ -30,7 +31,14 @@ export default [
3031
middleware: 'src/middleware.tsx',
3132
routing: 'src/routing.tsx',
3233
plugin: 'src/plugin.tsx',
33-
config: 'src/config.tsx'
34+
config: 'src/config.tsx',
35+
36+
// Workaround for https://github.com/rollup/rollup/issues/3916
37+
// See https://x.com/jamannnnnn/status/1880199734280732841
38+
...glob.sync('src/**/index.tsx').reduce((acc, file) => {
39+
acc[file.replace('src/', '').replace('/index.tsx', '/index')] = file;
40+
return acc;
41+
}, {})
3442
},
3543
external: [
3644
...Object.keys(pkg.dependencies),

0 commit comments

Comments
 (0)