464 questions
-3
votes
1
answer
60
views
Can web worker help split Vite result js file?
I am using Vite to build react application. And I have a js file with data (it is just a word dictionary). The file is big, its size is 28MB. Now it is imported and use in code directly. So built js ...
1
vote
0
answers
131
views
Chrome Extension Code Splitting with React.lazy + Vite - Chunk Loading Fails Despite Background Script Exclusion Body:
I’m building a Chrome extension using React 18 and Vite 5, trying to implement code splitting for optimization. Despite excluding background scripts from splitting, I’m getting chunk loading errors.
...
0
votes
1
answer
213
views
React lazy components with poor internet connectivity and error boundaries: Failed import due to poor connectivity seems to be cached even when online
In an "offline-first" app (which optimistically updates local state and gracefully handles errors by rolling back local state changes, for example), some features may still require internet ...
2
votes
4
answers
335
views
How to style Angular parent and child component
I'm learning Angular 18 while I already know React. I have a "pretty big" HTML file, which I would like to split. Let's take this pseudo and minified example:
<ul>
<li>Hello<...
1
vote
1
answer
299
views
How to splitting code shadcn form component in React/NextJs
I have just started learning Next.js and shadcn, but I am confused about how to split the code in the form component because my code has already reached 4000 lines.
How can I split it to make it ...
-1
votes
1
answer
154
views
Dynamic import path for React Native
I want to do is I want to import React-Native dynamic path.
example:
import Demo from `./screens/${path}`;
I found one method using lazy, but it also only working when initialize const variable like ...
5
votes
2
answers
10k
views
Vue & Vite disable code splitting / chunking
I have built a small application in Vue/TypeScript and with Vite and i am trying to build the files using vite build but this is chunking the files. The file is to be placed on other peoples website ...
-1
votes
1
answer
53
views
Reduce Import/Site Size of React Window Popup
I have a react app that has >10 pages and imports a number of npm modules.
import ReactDOM from "react-dom/client";
import { BrowserRouter, Routes, Route } from "react-router-dom&...
1
vote
0
answers
2k
views
Using Vite with code splitting enabled without adding the `type="module"` attribute in script
I'm working on an embeddable widget for websites where clients embed the widget into their website using a script tag in the following format:
<script src="https://embed.app.com/USER_ID"&...
2
votes
1
answer
524
views
Loading multiple JS bundles in React Native iOS
I'm trying to implement Code Splitting in a React Native app. Currently I managed to load multiple bundles in Android both in packager mode and in production mode.
However, on iOS I'm facing the ...
1
vote
1
answer
1k
views
Browser caching issue with code-splitting in production? (Failed to fetch dynamically imported module)
I'm using Vue + Vite for my web app, and I use code-splitting in my router file for most of the routes, for example:
{
path: "settings",
name: "settings",
component: () => ...
0
votes
0
answers
577
views
importing a simple string in index.tsx causes full .ts file to get bundled with the main bundle during build time
Technology used:
React
Typescript
Webpack
(Essentially an ejected create-react-app as we plan to move away from CRA)
Lazy loading at each route (react-router)
We've been diagnosing a large main bundle ...
1
vote
1
answer
2k
views
Why lazy loading doesn't work in my react project?
I have a project: link.
The project has router and lazy-components for every page.
Short example router-component:
export const RoutersComponent = () => {
return (
<HashRouter basename={'/...
2
votes
0
answers
788
views
Module federation prefetch during browser idle time
Requirement: To prefetch the remote modules(module federated) during browser idle time in react.
I've tried webpack magic comment webpackPrefetch: true but that did not work with module federation. I ...
2
votes
2
answers
1k
views
Preact: How to properly code split pre-rendererd components using dynamic import?
Backstory:
I'm working on a codebase which is primarily Python with Jinja templates because the site is mainly static. However, for interactive components we're using Preact to pre-render the ...
1
vote
1
answer
1k
views
When to create separate widget of a component in a very long flutter .dart file
I have this code as a part of a Column having many children making it as long as 400 lines. Is it a good practice to split widgets like these into separate files? What is the recommended number of ...
0
votes
2
answers
72
views
spliting based on a condition and Array arguments to IF are of different size
I'm working on a sheet that can be extracted from a system and all the data is in one cell so i need to split them and it is basic for all cells except for resutls. as you can see test results should ...
3
votes
0
answers
150
views
Webpack Code Spliting increases the overall bundle size by 300%
For explaining this issue. I have created a sample project.
I am using purescript. I am doing a dynamic import and webpack is generating 2 bundles.
If I comment the dynamic import and use a static ...
2
votes
0
answers
30
views
Separating Redux Async Middleware and general API functions
I am currently using createAsyncThunk to create async middlewares for a React-Redux app I am working on in the following manner:
import axios from "axios";
import ApiUrls from "../...
1
vote
0
answers
391
views
Proper way of using Redux and RTKQ in NextJs with code-splitting
This is a topic that's been discussed a lot through github issues and by now I've noticed two main opinions: It's not possible or it should not be done at all.
The argument for both sides is that ...
1
vote
2
answers
1k
views
Why does webpack use script tag for dynamic import when dynamic "import()" is already supported?
Lately I've been deep diving more about JS modules, Webpack, the difference between ES modules and CommonJS, and I came across the dynamic import topic. I was curious on how Webpack converts the ...
2
votes
0
answers
313
views
Rollup.js : How to choose a single export from a js file with multiple exports?
I have a single .js file containing multiple exports. It looks like this:
// some-functions.js
export function plusOne(value){
return value + 1
}
export function minusOne(value){
return ...
1
vote
1
answer
446
views
Import component from published npm package using react-loadable, cannot find module error
I am trying to import components from a published npm package dynamically using react-loadable. The import is successful with components located in the src/ folder. However any components that I try ...
1
vote
0
answers
951
views
React js Code Splitting not creating chunks
Im trying to lazy load routes but no matter what I do, I only have one main chunk. Here is the route code.
import React, { Suspense, lazy } from "react";
import {
HomePage,
ProductsPage,
...
3
votes
1
answer
7k
views
Why does Next.js pack JS chunks into static pages?
I'm looking into using Next.js for it's hybrid SSG/SSR features. Why are JS chunks being packed into simple pages that should require ZERO JavaScript?
The build command outputs:
Route (pages) ...