패치 파일을 업로드하려니 첨부가 안 되네요.
patches/@granite-js__mpack@0.1.33.patch를 아래 내용으로 생성하고
diff --git a/dist/metro/enhancedResolver.js b/dist/metro/enhancedResolver.js
index ecc4ee02fd28b612c5dd0ecb5d3126de8c1df4dc..a3258680eb08677b18203f0b9825712433716c72 100644
--- a/dist/metro/enhancedResolver.js
+++ b/dist/metro/enhancedResolver.js
@@ -66,7 +66,11 @@ function createResolver(rootPath, options) {
mainFields: context.mainFields,
conditionNames: options?.conditionNames ?? [...import_constants.RESOLVER_EXPORTS_MAP_CONDITIONS, "require", "node", "default"],
mainFiles: ["index"],
- modules: ["node_modules", import_path.default.join(rootPath2, "src")]
+ modules: ["node_modules", import_path.default.join(rootPath2, "src")],
+ alias: {
+ "react-native": import_path.default.join(rootPath2, "node_modules", "react-native"),
+ react: import_path.default.join(rootPath2, "node_modules", "react")
+ }
});
function resolve(context2, request) {
for (const nativeModule of NATIVE_MODULES) {
diff --git a/dist/metro/getMetroConfig.js b/dist/metro/getMetroConfig.js
index df272ce099bed94483da009e1ec446a710c489d2..d769377a92dfdd69600e54ab88473daec6712a24 100644
--- a/dist/metro/getMetroConfig.js
+++ b/dist/metro/getMetroConfig.js
@@ -31,14 +31,14 @@ __export(getMetroConfig_exports, {
getMetroConfig: () => getMetroConfig
});
module.exports = __toCommonJS(getMetroConfig_exports);
-var import_path = __toESM(require("path"));
var import_utils = require("@granite-js/utils");
-var import_enhancedResolver = require("./enhancedResolver");
-var import_getMonorepoRoot = require("./getMonorepoRoot");
+var import_path = __toESM(require("path"));
var import_constants = require("../constants");
var import_defaults = require("../vendors/metro-config/src/defaults");
var import_exclusionList = __toESM(require("../vendors/metro-config/src/defaults/exclusionList"));
var import_loadConfig = require("../vendors/metro-config/src/loadConfig");
+var import_enhancedResolver = require("./enhancedResolver");
+var import_getMonorepoRoot = require("./getMonorepoRoot");
const INTERNAL_CALLSITES_REGEX = new RegExp(
[
"/Libraries/Renderer/implementations/.+\\.js$",
@@ -100,12 +100,12 @@ async function getMetroConfig({ rootPath }, additionalConfig) {
resolveRequest,
// metro-file-map
sourceExts: [...import_constants.SOURCE_EXTENSIONS.map((extension) => extension.replace(/^\.?/, "")), "cjs", "mjs"],
- blockList: (0, import_exclusionList.default)(
- additionalConfig?.resolver?.blockList ? asArray(additionalConfig.resolver.blockList) : []
- ),
- nodeModulesPaths: additionalConfig?.resolver?.nodeModulesPaths || [],
+ blockList: (0, import_exclusionList.default)([
+ ...additionalConfig?.resolver?.blockList ? asArray(additionalConfig.resolver.blockList) : []
+ ]),
+ nodeModulesPaths: [import_path.default.join(rootPath, "node_modules"), ...additionalConfig?.resolver?.nodeModulesPaths || []],
extraNodeModules: additionalConfig?.resolver?.extraNodeModules || {},
- disableHierarchicalLookup: additionalConfig?.resolver?.disableHierarchicalLookup,
+ disableHierarchicalLookup: additionalConfig?.resolver?.disableHierarchicalLookup ?? true,
resolverMainFields: additionalConfig?.resolver?.resolverMainFields ?? import_constants.RESOLVER_MAIN_FIELDS
},
serializer: {
diff --git a/dist/vendors/metro/src/node-haste/DependencyGraph.js b/dist/vendors/metro/src/node-haste/DependencyGraph.js
index 5e1f0aa49ab102a3556fd4dd1df95f5cdd238438..886d2c2569209894dce7558b50debd87ca02c022 100644
--- a/dist/vendors/metro/src/node-haste/DependencyGraph.js
+++ b/dist/vendors/metro/src/node-haste/DependencyGraph.js
@@ -141,14 +141,24 @@ class DependencyGraph extends EventEmitter {
const containerName = splitIndex !== -1 ? filename.slice(0, splitIndex + 4) : filename;
const realpath = fs.realpathSync(containerName);
const resolvedPath = (pnpapi ? pnpapi.resolveVirtual(realpath) : realpath) ?? realpath;
- const sha1 = this._hasteFS.getSha1(resolvedPath);
+ let sha1 = this._hasteFS.getSha1(resolvedPath);
+ if (!sha1 && resolvedPath !== filename) {
+ sha1 = this._hasteFS.getSha1(filename);
+ }
if (!sha1) {
- throw new ReferenceError(
- `SHA-1 for file ${filename} (${resolvedPath}) is not computed.
- Potential causes:
- 1) You have symlinks in your project - watchman does not follow symlinks.
- 2) Check \`blockList\` in your metro.config.js and make sure it isn't excluding the file path.`
- );
+ try {
+ const crypto = require("crypto");
+ const content = fs.readFileSync(resolvedPath);
+ sha1 = crypto.createHash("sha1").update(content).digest("hex");
+ } catch (error) {
+ throw new ReferenceError(
+ `SHA-1 for file ${filename} (${resolvedPath}) is not computed.
+ Potential causes:
+ 1) You have symlinks in your project - watchman does not follow symlinks.
+ 2) Check \`blockList\` in your metro.config.js and make sure it isn't excluding the file path.
+ Error: ${error.message}`
+ );
+ }
}
return sha1;
}
pnpm-workspace.yaml에
patchedDependencies:
'@granite-js/mpack@0.1.33': patches/@granite-js__mpack@0.1.33.patch
추가하시면 됩니다.
다른 의존성들 버전은
catalog:
'@apps-in-toss/framework': 1.9.4
'@granite-js/native': 0.1.33
'@granite-js/react-native': 0.1.33
'@granite-js/plugin-hermes': 0.1.33
'@granite-js/plugin-router': 0.1.33
'@toss/tds-react-native': 1.3.8
'babel-preset-granite': 0.1.33
'react': 18.2.0
'react-native': 0.72.6
'typescript': 5.9.3
이렇게 사용하고 있습니다.