-
Notifications
You must be signed in to change notification settings - Fork 100
help: Unexpected token in Pathe #672
Comments
I think you should simply be able to remove the |
did't work
|
Would you provide a small reproduction via https://stackblitz.com/github/nuxt/starter/tree/v2 ? 🙏 |
https://stackblitz.com/edit/github-n735uj-mvickg?file=nuxt.config.js,package.json
So I downgrade my project swiper to @6.8.4 and closed |
@danielroe +1 on this from me. I can reproduce in [email protected] and trying to install @nuxtjs/composition-api [email protected]. We are not using the swiper package that @gping-system was using. Though there does seem to be some evidence online to support the theory that this issue stems from package version mismatches. No idea what features or usages in these packages that are causing this issue. If I can narrow down which package(s) it is for me, I'll post a follow-up here. Maybe you can see if there are similarities. |
@danielroe I think we got it. The We added a rule to our webpack config using the
|
@LTDanwithlegs this definitely works. Thanks for sharing. |
For Yarn 2/3 PnP users, this solution will result in absolute butt-load of stuff you'd need to add to
diff --git a/dist/shared/pathe.7f7ac46d.cjs b/dist/shared/pathe.7f7ac46d.cjs
index 00419e26cd22fa45625a19d549fc008cc632de92..5243fbfbd218fc259898025b11594235beb315cd 100644
--- a/dist/shared/pathe.7f7ac46d.cjs
+++ b/dist/shared/pathe.7f7ac46d.cjs
@@ -169,7 +169,7 @@ const dirname = function(p) {
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
const format = function(p) {
- const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
+ const segments = [p.root, p.dir, p.base || p.name + p.ext].filter(Boolean);
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
};
const basename = function(p, extension) {
diff --git a/dist/shared/pathe.fb014aa6.mjs b/dist/shared/pathe.fb014aa6.mjs
index 3bb15f817d6f7b475d1995bd9ba422059b2fea4c..ee2a2e876e8ea0d156b1c390cfbfdc1e8907ae5f 100644
--- a/dist/shared/pathe.fb014aa6.mjs
+++ b/dist/shared/pathe.fb014aa6.mjs
@@ -167,7 +167,7 @@ const dirname = function(p) {
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
};
const format = function(p) {
- const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
+ const segments = [p.root, p.dir, p.base || p.name + p.ext].filter(Boolean);
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
};
const basename = function(p, extension) {
diff --git a/dist/utils.cjs b/dist/utils.cjs
index ad224a84d69a9f6af4f11c9f0250a648fc646432..9e5ea3d7c4cc98eeca7070c1ca679a2d8cc8af62 100644
--- a/dist/utils.cjs
+++ b/dist/utils.cjs
@@ -34,7 +34,8 @@ function resolveAlias(path$1, aliases) {
}
const FILENAME_RE = /(^|[/\\])([^/\\]+?)(?=(\.[^.]+)?$)/;
function filename(path) {
- return path.match(FILENAME_RE)?.[2];
+ const match = path.match(FILENAME_RE)
+ return match ? match[2] : undefined;
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length;
diff --git a/dist/utils.mjs b/dist/utils.mjs
index 4c1379051eede406800cfe1a2625340e65118390..ad87764657a13d9d67c3049433d57c51acf96436 100644
--- a/dist/utils.mjs
+++ b/dist/utils.mjs
@@ -32,7 +32,8 @@ function resolveAlias(path, aliases) {
}
const FILENAME_RE = /(^|[/\\])([^/\\]+?)(?=(\.[^.]+)?$)/;
function filename(path) {
- return path.match(FILENAME_RE)?.[2];
+ const match = path.match(FILENAME_RE)
+ return match ? match[2] : undefined;
}
function _compareAliases(a, b) {
return b.split("/").length - a.split("/").length; And then update your "resolutions": {
"pathe@^0.3.3": "patch:pathe@npm%3A1.0.0#./.yarn/patches/pathe-npm-1.0.0-12bb397fc8.patch",
"pathe@^1.0.0": "patch:pathe@npm%3A1.0.0#./.yarn/patches/pathe-npm-1.0.0-12bb397fc8.patch"
} |
📚 What are you trying to do? Please describe.
i'm useing [email protected] and upgrade @nuxtjs/composition-api [email protected]
when it build it comes error
it seems like babel-loader cant' resolve function in pathe which is dependencies of @nuxt/composition-api,
and i don't know how to fix it
🔍 What have you tried?
I tried downgrade @nuxtjs/composition-api to @0.32.0 and it broken
Extend webpackConfig in nuxt.config.ts
of course babel-loader should't work,but i did't know which loader i shoud use in this case
ℹ️ Additional context
node version: v16.13.0
dependencies:
Thanks for your time
The text was updated successfully, but these errors were encountered: