Closed songdedku closed 4 days ago
Hi @songdedku,
from my point of view this doesn't point to any faulty logic in Re.Pack. You will need to provide a reproduction repository if you think the problem lies with Re.Pack.
Please note that you are also using react-native@0.72
which is no longer supported by Re.Pack. You can try updating to the newest version to see if the problem resolves itself.
Describe the bug
my webpack
import path from 'path'; import TerserPlugin from 'terser-webpack-plugin'; import * as Repack from '@callstack/repack';
export default env => { const { mode = 'development', context = Repack.getDirname(import.meta.url), entry = './index.js', platform = process.env.PLATFORM, minimize = mode === 'production', devServer = undefined, bundleFilename = undefined, sourceMapFilename = undefined, assetsPath = undefined, reactNativePath = new URL('./node_modules/react-native', import.meta.url) .pathname, } = env; const dirname = Repack.getDirname(import.meta.url);
if (!platform) { throw new Error('Missing platform'); }
process.env.BABEL_ENV = mode;
return { mode, devtool: false, context, entry: [ ...Repack.getInitializationEntries(reactNativePath, { hmr: devServer && devServer.hmr, }), entry, ], resolve: { ...Repack.getResolveOptions(platform), alias: { 'react-native': reactNativePath, }, }, 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: /.[cm]?[jt]sx?$/, include: [ // Include all node_modules except localforage /node_modules(?!\/localforage)/, ], use: 'babel-loader', type: 'javascript/dynamic', }, { test: /.[jt]sx?$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { plugins: devServer && devServer.hmr ? ['module:react-refresh/babel'] : undefined, }, }, }, { test: /.(ts|tsx)$/, use: [ { loader: 'ts-loader', options: { transpileOnly: true, }, }, ], type: 'javascript/dynamic', }, { test: /.(js|jsx)$/, // Matches .js and .jsx files exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env', '@babel/preset-react'], plugins: ['@babel/plugin-transform-runtime'], }, }, type: 'javascript/dynamic', }, { test: /.lottie$/, type: 'asset/resource', }, { test: /.svg$/, use: [ { loader: 'babel-loader', }, { loader: 'react-native-svg-loader', }, ], }, { test: Repack.getAssetExtensionsRegExp( Repack.ASSET_EXTENSIONS.filter(ext => ext !== 'svg'), ), use: { loader: '@callstack/repack/assets-loader', options: { platform, devServerEnabled: Boolean(devServer), scalableAssetExtensions: Repack.SCALABLE_ASSETS, }, }, }, ], }, plugins: [ new Repack.RepackPlugin({ context, mode, platform, devServer, output: { bundleFilename, sourceMapFilename, assetsPath, }, }),
}; };
System Info
Re.Pack Version
4.2.0
Reproduction
xxx
Steps to reproduce
error when i use Flatlist