New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.4.0] [npm] Unexpected token error when running in dev #4869
Comments
@eatyrghost Would you please share us (or privatetly) the |
Here i have the same issue after upgrade. Seems to throw error when parsing first page file. |
@pi0 I have the same error: show codeimport Vue from 'vue'
import Router from 'vue-router'
import { interopDefault } from './utils'
const _33982cc5 = () => interopDefault(import('../pages/a.vue' /* webpackChunkName: "pages/a" */))
const _7e89fc82 = () => interopDefault(import('../pages/a/_code.vue' /* webpackChunkName: "pages/a/_code" */))
const _46d39985 = () => interopDefault(import('../pages/a/_code/index.vue' /* webpackChunkName: "pages/a/_code/index" */))
const _29abbac7 = () => interopDefault(import('../pages/a/_code/cc/index.vue' /* webpackChunkName: "pages/a/_code/cc/index" */))
const _b6010c74 = () => interopDefault(import('../pages/a/_code/i/index.vue' /* webpackChunkName: "pages/a/_code/i/index" */))
const _6b71f13e = () => interopDefault(import('../pages/a/_code/s/index.vue' /* webpackChunkName: "pages/a/_code/s/index" */))
const _2e42396c = () => interopDefault(import('../pages/b.vue' /* webpackChunkName: "pages/b" */))
const _c63e0222 = () => interopDefault(import('../pages/b/index.vue' /* webpackChunkName: "pages/b/index" */))
const _16b63ac5 = () => interopDefault(import('../pages/d.vue' /* webpackChunkName: "pages/d" */))
const _4ed33f31 = () => interopDefault(import('../pages/l.vue' /* webpackChunkName: "pages/l" */))
const _2f035343 = () => interopDefault(import('../pages/p.vue' /* webpackChunkName: "pages/p" */))
const _4574e167 = () => interopDefault(import('../pages/p/o.vue' /* webpackChunkName: "pages/p/o" */))
const _1f2bcbfa = () => interopDefault(import('../pages/p/rc/index.vue' /* webpackChunkName: "pages/p/rc/index" */))
const _eb9413de = () => interopDefault(import('../pages/p/rcu.vue' /* webpackChunkName: "pages/p/rcu" */))
const _32997946 = () => interopDefault(import('../pages/p/ts/index.vue' /* webpackChunkName: "pages/p/ts/index" */))
const _20f67cf4 = () => interopDefault(import('../pages/p/rc/_code.vue' /* webpackChunkName: "pages/p/rc/_code" */))
const _34642a40 = () => interopDefault(import('../pages/p/ts/_code.vue' /* webpackChunkName: "pages/p/ts/_code" */))
const _8b2c6680 = () => interopDefault(import('../pages/support.vue' /* webpackChunkName: "pages/support" */))
const _461ede83 = () => interopDefault(import('../pages/index.vue' /* webpackChunkName: "pages/index" */))
Vue.use(Router)
if (process.client) {
window.history.scrollRestoration = 'manual'
}
const scrollBehavior = function (to, from, savedPosition) {
// if the returned position is falsy or an empty object,
// will retain current scroll position.
let position = false
// if no children detected and scrollToTop is not explicitly disabled
if (
to.matched.length < 2 &&
to.matched.every(r => r.components.default.options.scrollToTop !== false)
) {
// scroll to the top of the page
position = { x: 0, y: 0 }
} else if (to.matched.some(r => r.components.default.options.scrollToTop)) {
// if one of the children has scrollToTop option set to true
position = { x: 0, y: 0 }
}
// savedPosition is only available for popstate navigations (back button)
if (savedPosition) {
position = savedPosition
}
return new Promise((resolve) => {
// wait for the out transition to complete (if necessary)
window.$nuxt.$once('triggerScroll', () => {
// coords will be used if no selector is provided,
// or if the selector didn't match any element.
if (to.hash) {
let hash = to.hash
// CSS.escape() is not supported with IE and Edge.
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
hash = '#' + window.CSS.escape(hash.substr(1))
}
try {
if (document.querySelector(hash)) {
// scroll to anchor by returning the selector
position = { selector: hash }
}
} catch (e) {
console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).')
}
}
resolve(position)
})
})
}
export function createRouter() {
return new Router({
mode: 'history',
base: '/',
linkActiveClass: 'active',
linkExactActiveClass: 'activeExact',
scrollBehavior,
routes: [{
path: "/a",
component: _33982cc5,
name: "a",
children: [{
path: ":code?",
component: _7e89fc82,
children: [{
path: "",
component: _46d39985,
name: "a-code"
}, {
path: "cc",
component: _29abbac7,
name: "a-code-cc"
}, {
path: "i",
component: _b6010c74,
name: "a-code-i"
}, {
path: "s",
component: _6b71f13e,
name: "a-code-s"
}]
}]
}, {
path: "/b",
component: _2e42396c,
children: [{
path: "",
component: _c63e0222,
name: "b"
}]
}, {
path: "/d",
component: _16b63ac5,
name: "d"
}, {
path: "/l",
component: _4ed33f31,
name: "l"
}, {
path: "/p",
component: _2f035343,
name: "p",
children: [{
path: "o",
component: _4574e167,
name: "p-o"
}, {
path: "rc",
component: _1f2bcbfa,
name: "p-rc"
}, {
path: "rcu",
component: _eb9413de,
name: "p-rcu"
}, {
path: "ts",
component: _32997946,
name: "p-ts"
}, {
path: "rc/:code?",
component: _20f67cf4,
name: "p-rc-code"
}, {
path: "ts/:code?",
component: _34642a40,
name: "p-ts-code"
}]
}, {
path: "/support",
component: _8b2c6680,
name: "support"
}, {
path: "/",
component: _461ede83,
name: "index"
}],
fallback: false
})
} |
This is probably related to webpack regression. Please remove Link to the issue: webpack/webpack#8656 Update Alternative solution: npm update acorn --depth 20
npm dedupe |
@martymclaughlan @eskimm @eatyrghost for ensuring, as the issue that I mentioned is related to NPM package manager. Do you confirm:
|
I also have the same issue. I am using |
@LeCoupa Would you please also upgrade nuxt? |
Upgrading to Do we have to use a module like this now? module.exports = {
modules: [
"@nuxtjs/axios",
"@nuxtjs/dotenv",
"@nuxtjs/pwa",
"nuxt-material-design-icons",
[
"nuxt-sass-resources-loader",
[
// Global variables, site-wide settings, config switches, etc
"@/assets/settings/_settings.colors.scss",
// Site-wide mixins and functions
"@/assets/tools/_tools.mq.scss"
]
]
} |
Yeah nuxt-sass-resources-loader is broken for me too now |
@martymclaughlan @LeCoupa regarding |
PS: Alternative official module is style-resources-module |
Related issue: #4839 |
Closing as there is a related open issue ( #4839 ) and problem added to release notes. |
“ npm should either remove package-lock.json and reinstall before upgrade or use npm update acorn --depth 20 && npm dedupe after upgrading to 2.4.0.“ |
@joeyzone You are a lifesaver! None of the previous steps worked for me either. |
happy to help you. |
Version
v2.4.0
Reproduction link
https://i-cannot-share-private-repos.com/
Steps to reproduce
nuxt
to build for dev.What is expected ?
It compiles and builds the web site.
What is actually happening?
It throws an error:
Additional comments?
All I did was upgrade using
npm install -D nuxt@2.4.0
to get the latest version. Not sure if there are other changes I need to make (nothing was mentioned in the release notes).The text was updated successfully, but these errors were encountered: