@astrojs/cloudflare 10.2.5 → 10.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -175,6 +175,20 @@ export default function createIntegration(args) {
|
|
|
175
175
|
// @ts-expect-error
|
|
176
176
|
vite.build.rollupOptions.output.banner ||=
|
|
177
177
|
'globalThis.process ??= {}; globalThis.process.env ??= {};';
|
|
178
|
+
// @ts-expect-error
|
|
179
|
+
vite.build.rollupOptions.output.manualChunks = (id) => {
|
|
180
|
+
if (id.includes('node_modules')) {
|
|
181
|
+
if (id.indexOf('node_modules') !== -1) {
|
|
182
|
+
const basic = id.toString().split('node_modules/')[1];
|
|
183
|
+
const sub1 = basic.split('/')[0];
|
|
184
|
+
if (sub1 !== '.pnpm') {
|
|
185
|
+
return sub1.toString();
|
|
186
|
+
}
|
|
187
|
+
const name2 = basic.split('/')[1];
|
|
188
|
+
return name2.split('@')[name2[0] === '@' ? 1 : 0].toString();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
178
192
|
vite.build.rollupOptions.external = _config.vite.build?.rollupOptions?.external ?? [];
|
|
179
193
|
// Cloudflare env is only available per request. This isn't feasible for code that access env vars
|
|
180
194
|
// in a global way, so we shim their access as `process.env.*`. This is not the recommended way for users to access environment variables. But we'll add this for compatibility for chosen variables. Mainly to support `@astrojs/db`
|
|
@@ -191,6 +205,11 @@ export default function createIntegration(args) {
|
|
|
191
205
|
vite.resolve ||= {};
|
|
192
206
|
vite.resolve.conditions ||= [];
|
|
193
207
|
vite.resolve.conditions = vite.resolve.conditions.filter((c) => c !== 'workerd' && c !== 'worker');
|
|
208
|
+
vite.build ||= {};
|
|
209
|
+
vite.build.rollupOptions ||= {};
|
|
210
|
+
vite.build.rollupOptions.output ||= {};
|
|
211
|
+
// @ts-expect-error
|
|
212
|
+
vite.build.rollupOptions.output.manualChunks = undefined;
|
|
194
213
|
}
|
|
195
214
|
},
|
|
196
215
|
'astro:build:done': async ({ pages, routes, dir, logger }) => {
|