mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
fix(scripts): allow change libESM from deper level
With these changes the script for js extension for libESM can now change when from deeper levels.
This commit is contained in:
@@ -32,7 +32,11 @@ const addJSExtensionPlugin = ({ types }) => {
|
||||
const match = src.match(/^@trezor\/([^/]+)\/libESM\/(.+)$/);
|
||||
const [, packageName, subpath] = match;
|
||||
|
||||
const packagesRoot = path.resolve(state.filename, '..', '..', '..', '..');
|
||||
// Find packages/ root from the current file's absolute path by locating the libESM/ segment.
|
||||
// e.g., /packages/connect/libESM/device/thp/pairing.js → /packages/
|
||||
const libESMIndex = state.filename.indexOf(`${path.sep}libESM${path.sep}`);
|
||||
const packageDir = state.filename.substring(0, libESMIndex);
|
||||
const packagesRoot = path.dirname(packageDir);
|
||||
const resolvedPath = path.join(packagesRoot, packageName, 'libESM', subpath);
|
||||
|
||||
const isDirectory =
|
||||
|
||||
Reference in New Issue
Block a user