Restructure package files, add exports (#13530)

Co-authored-by: Sosuke Suzuki <aosukeke@gmail.com>
This commit is contained in:
fisker CheungandSosuke Suzuki authored and GitHub committed 2022-10-06 15:20:19 +08:00
1 parent e132a9ba43
commit 31a796d32c
17 files changed
+232 -111

No files matched your search

+9 -1
View File
@@ -19,6 +19,14 @@ const { dirname, readJsonSync, require } = createEsmUtils(import.meta);
const packageJson = readJsonSync("../../package.json");
const universalTarget = browserslistToEsbuild(packageJson.browserslist);
const getRelativePath = (from, to) => {
const relativePath = path.posix.relative(path.dirname(`/${from}`), `/${to}`);
if (!relativePath.startsWith(".")) {
return `./${relativePath}`;
}
return relativePath;
};
function getEsbuildOptions({ file, files, shouldCollectLicenses, cliOptions }) {
// Save dependencies to file
@@ -127,7 +135,7 @@ function getEsbuildOptions({ file, files, shouldCollectLicenses, cliOptions }) {
return {
module: path.join(PROJECT_ROOT, bundle.input),
external: `./${output}`,
external: getRelativePath(file.output.file, output),
};
})
);