We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting ChunkLoadError if there is a lazy load import
For example: const Modal = React.lazy(() => import('../_game/ModalA'));
when this Modal is used Im getting a chunkLoadError, how to resolve this ?
Im just setting up repack for my project so I might be missing something
My config file:
import { createRequire } from 'node:module'; import path from 'node:path'; import TerserPlugin from 'terser-webpack-plugin'; import * as Repack from '@callstack/repack'; const dirname = Repack.getDirname(import.meta.url); const { resolve } = createRequire(import.meta.url); export default (env) => { const { mode = 'development', context = dirname, entry = './index.js', platform = process.env.PLATFORM, minimize = mode === 'production', devServer = undefined, bundleFilename = undefined, sourceMapFilename = undefined, assetsPath = undefined, reactNativePath = resolve('react-native') } = env; if (!platform) { throw new Error('Missing platform'); } process.env.BABEL_ENV = mode; const alias = { }; return { mode, devtool: false, context, entry: [ ...Repack.getInitializationEntries(reactNativePath, { hmr: devServer && devServer.hmr }), entry ], resolve: { ...Repack.getResolveOptions(platform), alias }, output: { clean: true, hashFunction: 'xxhash64', path: path.join(dirname, 'build/generated', platform), filename: 'index.bundle', chunkFilename: '[name].chunk.bundle', publicPath: Repack.getPublicPath({ platform, devServer }) }, optimization: { minimize, minimizer: [ new TerserPlugin({ test: /\.(js)?bundle(\?.*)?$/i, extractComments: false, terserOptions: { format: { comments: false } } }) ], chunkIds: 'named' }, module: { rules: [ { test: /\.[jt]sx?$/, include: [ /node_modules(.*[/\\])+react\//, /node_modules(.*[/\\])+react-native/, /node_modules(.*[/\\])+@react-native/, /node_modules(.*[/\\])+react-freeze/, /node_modules(.*[/\\])+rn-gzip/, /node_modules(.*[/\\])+rn-fetch-blob/, /node_modules(.*[/\\])+@react-navigation/, /node_modules(.*[/\\])+@react-native-community/, /node_modules(.*[/\\])+expo/, /node_modules(.*[/\\])+pretty-format/, /node_modules(.*[/\\])+metro/, /node_modules(.*[/\\])+abort-controller/, /node_modules(.*[/\\])+@callstack/, /node_modules(.*[/\\])+@callstack(.*[/\\])+repack/ ], use: 'babel-loader' }, { test: /\.[jt]sx?$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { /** Add React Refresh transform only when HMR is enabled. */ plugins: devServer && devServer.hmr ? ['module:react-refresh/babel'] : undefined } } }, { test: Repack.getAssetExtensionsRegExp(Repack.ASSET_EXTENSIONS), use: { loader: '@callstack/repack/assets-loader', options: { platform, devServerEnabled: Boolean(devServer), /** * Defines which assets are scalable - which assets can have * scale suffixes: `@1x`, `@2x` and so on. * By default all images are scalable. */ scalableAssetExtensions: Repack.SCALABLE_ASSETS } } } ] }, plugins: [ new Repack.RepackPlugin({ context, mode, platform, devServer, output: { bundleFilename, sourceMapFilename, assetsPath } }) ] }; };
Thanks in advance
The text was updated successfully, but these errors were encountered:
Im not getting this error if I don't have a Lazy import
Sorry, something went wrong.
@jbroma can you help me out for this issue ?
@varunraghu3112 it looks to me that you might need to configure resolver through ScriptManager.shared.addResolver. Please check out the documentation that we have here: https://re-pack.dev/docs/code-splitting/usage
ScriptManager.shared.addResolver
No branches or pull requests
Getting ChunkLoadError if there is a lazy load import
For example:
const Modal = React.lazy(() => import('../_game/ModalA'));
when this Modal is used Im getting a chunkLoadError, how to resolve this ?
Im just setting up repack for my project so I might be missing something
My config file:
Thanks in advance
The text was updated successfully, but these errors were encountered: