diff --git a/distributions/nuxt-start/package.json b/distributions/nuxt-start/package.json
index 003ced8fc18d..b61023de2b20 100644
--- a/distributions/nuxt-start/package.json
+++ b/distributions/nuxt-start/package.json
@@ -57,7 +57,7 @@
"dependencies": {
"@nuxt/cli": "2.13.1",
"@nuxt/core": "2.13.1",
- "@nuxt/telemetry": "^1.1.0",
+ "@nuxt/telemetry": "^1.2.0",
"node-fetch": "^2.6.0",
"vue": "^2.6.11",
"vue-client-only": "^2.0.0",
diff --git a/distributions/nuxt/package.json b/distributions/nuxt/package.json
index 575a78eda3db..41bb94b96375 100644
--- a/distributions/nuxt/package.json
+++ b/distributions/nuxt/package.json
@@ -60,12 +60,12 @@
"dependencies": {
"@nuxt/builder": "2.13.1",
"@nuxt/cli": "2.13.1",
- "@nuxt/components": "^1.0.4",
+ "@nuxt/components": "^1.0.5",
"@nuxt/core": "2.13.1",
"@nuxt/generator": "2.13.1",
- "@nuxt/loading-screen": "^2.0.1",
+ "@nuxt/loading-screen": "^2.0.2",
"@nuxt/opencollective": "^0.3.0",
- "@nuxt/telemetry": "^1.1.0",
+ "@nuxt/telemetry": "^1.2.0",
"@nuxt/webpack": "2.13.1"
},
"engines": {
diff --git a/package.json b/package.json
index aef533b036a0..c670a86cd5f9 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"@vue/test-utils": "^1.0.3",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"create-require": "^1.0.2",
"cross-spawn": "^7.0.3",
"eslint": "^7.3.1",
@@ -72,7 +72,7 @@
"lodash": "^4.17.15",
"node-fetch": "^2.6.0",
"node-sass": "^4.14.1",
- "puppeteer-core": "^4.0.0",
+ "puppeteer-core": "^4.0.1",
"request": "^2.88.2",
"rimraf": "^3.0.2",
"rollup": "2.18.0",
diff --git a/packages/builder/package.json b/packages/builder/package.json
index 18cd7137e8b0..0929cec4c04c 100644
--- a/packages/builder/package.json
+++ b/packages/builder/package.json
@@ -14,7 +14,7 @@
"@nuxt/webpack": "2.13.1",
"chalk": "^3.0.0",
"chokidar": "^3.4.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"fs-extra": "^8.1.0",
"glob": "^7.1.6",
"hash-sum": "^2.0.0",
diff --git a/packages/cli/package.json b/packages/cli/package.json
index 7052ec42f777..e0d2ce1897fc 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -18,7 +18,7 @@
"chalk": "^3.0.0",
"compression": "^1.7.4",
"connect": "^3.7.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"esm": "^3.2.25",
"execa": "^3.4.0",
"exit": "^0.1.2",
diff --git a/packages/cli/src/commands/export.js b/packages/cli/src/commands/export.js
index a06c74b86d86..a77ebb604617 100644
--- a/packages/cli/src/commands/export.js
+++ b/packages/cli/src/commands/export.js
@@ -34,7 +34,7 @@ export default {
}
const generator = await cmd.getGenerator(nuxt)
- await nuxt.server.listen()
+ await nuxt.server.listen(0)
const { errors } = await generator.generate({
init: true,
diff --git a/packages/cli/src/commands/generate.js b/packages/cli/src/commands/generate.js
index 552037d895bc..b77a8d09e7c9 100644
--- a/packages/cli/src/commands/generate.js
+++ b/packages/cli/src/commands/generate.js
@@ -95,7 +95,7 @@ export default {
}
const generator = await cmd.getGenerator(nuxt)
- await nuxt.server.listen()
+ await nuxt.server.listen(0)
const { errors } = await generator.generate({
init: true,
diff --git a/packages/config/package.json b/packages/config/package.json
index 7f83eef5ee8e..aef203cd301d 100644
--- a/packages/config/package.json
+++ b/packages/config/package.json
@@ -11,7 +11,7 @@
],
"dependencies": {
"@nuxt/utils": "2.13.1",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"create-require": "^1.0.2",
"defu": "^2.0.4",
"destr": "^1.0.0",
diff --git a/packages/core/package.json b/packages/core/package.json
index 41e07d46fbed..ee34cf7b6bba 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -13,7 +13,7 @@
"@nuxt/server": "2.13.1",
"@nuxt/utils": "2.13.1",
"@nuxt/vue-renderer": "2.13.1",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"debug": "^4.1.1",
"esm": "^3.2.25",
"fs-extra": "^8.1.0",
diff --git a/packages/core/src/module.js b/packages/core/src/module.js
index 1b578433cb67..5b51cc31b279 100644
--- a/packages/core/src/module.js
+++ b/packages/core/src/module.js
@@ -191,10 +191,16 @@ export default class ModuleContainer {
}
// Ensure module is required once
- const key = (handler.meta && handler.meta.name) || src
+ const metaKey = handler.meta && handler.meta.name
+ const key = metaKey || src
if (typeof key === 'string') {
if (this.requiredModules[key]) {
- return
+ if (!metaKey) {
+ // TODO: Skip with nuxt3
+ consola.warn('Modules should be only specified once:', key)
+ } else {
+ return
+ }
}
this.requiredModules[key] = { src, options, handler }
}
diff --git a/packages/generator/package.json b/packages/generator/package.json
index f1db5b006ad2..e4d39f5dfd8c 100644
--- a/packages/generator/package.json
+++ b/packages/generator/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@nuxt/utils": "2.13.1",
"chalk": "^3.0.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"fs-extra": "^8.1.0",
"html-minifier": "^4.0.0",
"node-html-parser": "^1.2.20"
diff --git a/packages/server/package.json b/packages/server/package.json
index 56dd4912e02d..e3e336f151da 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -15,7 +15,7 @@
"chalk": "^3.0.0",
"compression": "^1.7.4",
"connect": "^3.7.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"etag": "^1.8.1",
"fresh": "^0.5.2",
"fs-extra": "^8.1.0",
diff --git a/packages/types/package.json b/packages/types/package.json
index 500c650685a3..22695575f69d 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -23,7 +23,7 @@
"@types/pug": "^2.0.4",
"@types/serve-static": "^1.13.4",
"@types/terser-webpack-plugin": "^2.2.0",
- "@types/webpack": "^4.41.17",
+ "@types/webpack": "^4.41.18",
"@types/webpack-bundle-analyzer": "^3.8.0",
"@types/webpack-dev-middleware": "^3.7.1",
"@types/webpack-hot-middleware": "^2.25.3"
diff --git a/packages/utils/package.json b/packages/utils/package.json
index 00af6df48cff..47e2aaac20fa 100644
--- a/packages/utils/package.json
+++ b/packages/utils/package.json
@@ -8,7 +8,7 @@
"dist"
],
"dependencies": {
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"fs-extra": "^8.1.0",
"hash-sum": "^2.0.0",
"proper-lockfile": "^4.1.1",
diff --git a/packages/utils/src/resolve.js b/packages/utils/src/resolve.js
index 09972caa837b..79d43f516af0 100644
--- a/packages/utils/src/resolve.js
+++ b/packages/utils/src/resolve.js
@@ -18,10 +18,9 @@ export const wp = function wp (p = '') {
}
export const wChunk = function wChunk (p = '') {
- if (isWindows) {
- return p.replace(/\//g, '_')
- }
- return p
+ // workaround for SplitChunksPlugin that generate names starting from . for catchAll pages _.vue
+ // consider using https://webpack.js.org/configuration/output/#outputfilename for more robust control over filename generation
+ return p.replace('_', '[_]')
}
const reqSep = /\//g
diff --git a/packages/utils/src/route.js b/packages/utils/src/route.js
index 3c08109d6a2c..95dc8f238ee3 100644
--- a/packages/utils/src/route.js
+++ b/packages/utils/src/route.js
@@ -13,14 +13,19 @@ export const flatRoutes = function flatRoutes (router, fileName = '', routes = [
if (fileName === '' && r.path === '/') {
routes.push('/')
}
+
return flatRoutes(r.children, fileName + r.path + '/', routes)
}
fileName = fileName.replace(/\/+/g, '/')
- routes.push(
- (r.path === '' && fileName[fileName.length - 1] === '/'
- ? fileName.slice(0, -1)
- : fileName) + r.path
- )
+
+ // if child path is already absolute, do not make any concatenations
+ if (r.path && r.path.startsWith('/')) {
+ routes.push(r.path)
+ } else if (r.path === '' && fileName[fileName.length - 1] === '/') {
+ routes.push(fileName.slice(0, -1) + r.path)
+ } else {
+ routes.push(fileName + r.path)
+ }
})
return routes
}
diff --git a/packages/utils/test/resolve.win.test.js b/packages/utils/test/resolve.win.test.js
index 3feb80b84dc1..768e26a5aa36 100644
--- a/packages/utils/test/resolve.win.test.js
+++ b/packages/utils/test/resolve.win.test.js
@@ -12,7 +12,7 @@ describe.win('util: resolve windows', () => {
})
test('should format windows path', () => {
- expect(wChunk('nuxt/layout/test')).toEqual('nuxt_layout_test')
+ expect(wChunk('nuxt/layout/test')).toEqual('nuxt/layout/test')
})
test('should resolve alias path', () => {
diff --git a/packages/utils/test/route.test.js b/packages/utils/test/route.test.js
index 4ec0ee35bffb..7422d55c13f0 100644
--- a/packages/utils/test/route.test.js
+++ b/packages/utils/test/route.test.js
@@ -40,6 +40,37 @@ describe('util: route', () => {
expect(routes).toEqual(['/', '/foo/bar', '/foo/baz'])
})
+ test('should flat absolute routes', () => {
+ const routes = flatRoutes([
+ {
+ name: 'foo',
+ path: '/foo',
+ children: [
+ { name: 'foo-bar', path: '/foo/bar' },
+ { name: 'foo-baz', path: '/foo/baz' }
+ ]
+ }
+ ])
+
+ expect(routes).toEqual(['/foo/bar', '/foo/baz'])
+ })
+
+ test('should flat absolute routes with empty path', () => {
+ const routes = flatRoutes([
+ {
+ name: 'foo',
+ path: '/foo',
+ children: [
+ { name: 'foo-root', path: '' },
+ { name: 'foo-bar', path: '/foo/bar' },
+ { name: 'foo-baz', path: '/foo/baz' }
+ ]
+ }
+ ])
+
+ expect(routes).toEqual(['/foo', '/foo/bar', '/foo/baz'])
+ })
+
describe('util: route guard', () => {
test('should guard parent dir', () => {
expect(() => {
diff --git a/packages/vue-app/template/App.js b/packages/vue-app/template/App.js
index c05150ed5bd7..0744e9173019 100644
--- a/packages/vue-app/template/App.js
+++ b/packages/vue-app/template/App.js
@@ -41,25 +41,12 @@ export default {
render (h, props) {
<% if (loading) { %>const loadingEl = h('NuxtLoading', { ref: 'loading' })<% } %>
<% if (features.layouts) { %>
- <% if (components.ErrorPage) { %>
- if (this.nuxt.err && NuxtError) {
- const errorLayout = (NuxtError.options || NuxtError).layout
- if (errorLayout) {
- this.setLayout(
- typeof errorLayout === 'function'
- ? errorLayout.call(NuxtError, this.context)
- : errorLayout
- )
- }
- }
- <% } %>
const layoutEl = h(this.layout || 'nuxt')
const templateEl = h('div', {
domProps: {
id: '__layout'
},
-
- key: this.layoutName
+ key: this.layoutName
}, [layoutEl])
<% } else { %>
const templateEl = h('nuxt')
@@ -308,7 +295,7 @@ export default {
if (base && route.startsWith(base)) {
route = route.substr(base.length)
}
- route = (route.replace(/\/+$/, '') || '/').split('?')[0]
+ route = (route.replace(/\/+$/, '') || '/').split('?')[0].split('#')[0]
const src = urlJoin(base, staticAssetsBase, route, 'payload.js')
try {
const payload = await window.__NUXT_IMPORT__(decodeURI(route), encodeURI(src))
diff --git a/packages/vue-renderer/package.json b/packages/vue-renderer/package.json
index 7279fa52091d..872c1be9e9a5 100644
--- a/packages/vue-renderer/package.json
+++ b/packages/vue-renderer/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@nuxt/devalue": "^1.2.4",
"@nuxt/utils": "2.13.1",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"fs-extra": "^8.1.0",
"lru-cache": "^5.1.1",
"vue": "^2.6.11",
diff --git a/packages/webpack/package.json b/packages/webpack/package.json
index d90c4e473b12..b88dcd09ea65 100644
--- a/packages/webpack/package.json
+++ b/packages/webpack/package.json
@@ -16,7 +16,7 @@
"cache-loader": "^4.1.0",
"caniuse-lite": "^1.0.30001088",
"chalk": "^3.0.0",
- "consola": "^2.13.0",
+ "consola": "^2.14.0",
"css-loader": "^3.6.0",
"cssnano": "^4.1.10",
"eventsource-polyfill": "^0.9.6",
diff --git a/packages/webpack/src/builder.js b/packages/webpack/src/builder.js
index 3d9545710fb3..2cd35e2ebf6a 100644
--- a/packages/webpack/src/builder.js
+++ b/packages/webpack/src/builder.js
@@ -176,6 +176,7 @@ export class WebpackBundler {
stats: false,
logLevel: 'silent',
watchOptions: this.buildContext.options.watchers.webpack,
+ fs: compiler.outputFileSystem,
...buildOptions.devMiddleware
})
)
diff --git a/test/dev/extract-css.test.js b/test/dev/extract-css.test.js
index a507c69a3714..bb6086f3c980 100644
--- a/test/dev/extract-css.test.js
+++ b/test/dev/extract-css.test.js
@@ -5,7 +5,6 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let nuxt = null
const readFile = promisify(fs.readFile)
-const isWindows = process.platform.startsWith('win')
describe('extract css', () => {
beforeAll(async () => {
@@ -17,7 +16,7 @@ describe('extract css', () => {
})
test('Verify global.css has been extracted and minified', async () => {
- const fileName = isWindows ? 'pages_index.css' : 'pages/index.css'
+ const fileName = 'pages/index.css'
const extractedIndexCss = resolve(__dirname, '..', 'fixtures/extract-css/.nuxt/dist/client', fileName)
const content = await readFile(extractedIndexCss, 'utf-8')
diff --git a/test/fixtures/full-static/layouts/default.vue b/test/fixtures/full-static/layouts/default.vue
index fa9728073732..5f079d32cb8f 100644
--- a/test/fixtures/full-static/layouts/default.vue
+++ b/test/fixtures/full-static/layouts/default.vue
@@ -10,7 +10,7 @@
Pagination
-
+
Dynamic route 1
diff --git a/yarn.lock b/yarn.lock
index afab875d6337..1c5e6c3b7601 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1846,10 +1846,10 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
-"@nuxt/components@^1.0.4":
- version "1.0.4"
- resolved "https://registry.npmjs.org/@nuxt/components/-/components-1.0.4.tgz#8a22c080bdb0061a7aafc632ab8c055d70e479ce"
- integrity sha512-21+wVCwKmH1lzmi2e5dC2NwhMc0LEgAkkqeYtYjWHFN6D1G09l5BeNQF1rfFBQ82R9/AqRiCS8aGIAaWwUp8vQ==
+"@nuxt/components@^1.0.5":
+ version "1.0.5"
+ resolved "https://registry.npmjs.org/@nuxt/components/-/components-1.0.5.tgz#90e95201ede263638f57ab49b168a8971c00e554"
+ integrity sha512-EBfW8C1DyAWs3p/jxGveaYxQ020jsLmKMKcyuzWWtfkVCwA/2KtaPCsV5H+zq6tNSr9GWtgOBi0ChgKetqRtJQ==
dependencies:
chalk "^4.1.0"
chokidar "^3.4.0"
@@ -1875,10 +1875,10 @@
error-stack-parser "^2.0.0"
string-width "^2.0.0"
-"@nuxt/loading-screen@^2.0.1":
- version "2.0.1"
- resolved "https://registry.npmjs.org/@nuxt/loading-screen/-/loading-screen-2.0.1.tgz#4049796e26b57a627a669ddc4c75771e7f6f38d6"
- integrity sha512-oTtSHDZ+kaWUKpovgf2zM9gOiWLrZHcdmmLsveeTpJ0Q8Xk+sXR3HIRN2IBl5gFbPK6V/pYaum/LQBg73UirIQ==
+"@nuxt/loading-screen@^2.0.2":
+ version "2.0.2"
+ resolved "https://registry.npmjs.org/@nuxt/loading-screen/-/loading-screen-2.0.2.tgz#2082e813a93bb4efa42be05a6b448121b5f1cad8"
+ integrity sha512-29fLSfSNwCLnpXPbnTbMlgK4u5rw1raJBcBjTNlONfTo2FasWxyEgZ2HMMRlJoikMxxB9FZsjdegnYcplhiRTA==
dependencies:
connect "^3.7.0"
defu "^2.0.4"
@@ -1895,10 +1895,10 @@
consola "^2.10.1"
node-fetch "^2.6.0"
-"@nuxt/telemetry@^1.1.0":
- version "1.1.0"
- resolved "https://registry.npmjs.org/@nuxt/telemetry/-/telemetry-1.1.0.tgz#47e71a575e268a6c4918daa3ffdeff7dfcf688d9"
- integrity sha512-XjeSdVT2g4XonpJmQkCswUVmmeSOBYGho5fgmWLvjQMCYsoRlOvdh+tn/cTtfQRleZfWQ6ajm/dqXaEPxK9/yg==
+"@nuxt/telemetry@^1.2.0":
+ version "1.2.0"
+ resolved "https://registry.npmjs.org/@nuxt/telemetry/-/telemetry-1.2.0.tgz#0280cec099b6f0137477977d81ee8aa557d40d7a"
+ integrity sha512-TKpfkt5+iGf5YF4xXxKNzIi94lLCaogoJRk6RSAcqEZhPVkmMCSk5g6D4BNSqiB0rIUCLWetUP6lZBrgbEZ8Gg==
dependencies:
arg "^4.1.3"
ci-info "^2.0.0"
@@ -2516,7 +2516,7 @@
"@types/source-list-map" "*"
source-map "^0.7.3"
-"@types/webpack@*", "@types/webpack@^4.41.17", "@types/webpack@^4.41.8":
+"@types/webpack@*", "@types/webpack@^4.41.8":
version "4.41.17"
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.17.tgz#0a69005e644d657c85b7d6ec1c826a71bebd1c93"
integrity sha512-6FfeCidTSHozwKI67gIVQQ5Mp0g4X96c2IXxX75hYEQJwST/i6NyZexP//zzMOBb+wG9jJ7oO8fk9yObP2HWAw==
@@ -2528,6 +2528,18 @@
"@types/webpack-sources" "*"
source-map "^0.6.0"
+"@types/webpack@^4.41.18":
+ version "4.41.18"
+ resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.18.tgz#2945202617866ecdffa582087f1b6de04a7eed55"
+ integrity sha512-mQm2R8vV2BZE/qIDVYqmBVLfX73a8muwjs74SpjEyJWJxeXBbsI9L65Pcia9XfYLYWzD1c1V8m+L0p30y2N7MA==
+ dependencies:
+ "@types/anymatch" "*"
+ "@types/node" "*"
+ "@types/tapable" "*"
+ "@types/uglify-js" "*"
+ "@types/webpack-sources" "*"
+ source-map "^0.6.0"
+
"@types/yargs-parser@*":
version "15.0.0"
resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d"
@@ -4332,6 +4344,11 @@ consola@^2.10.0, consola@^2.10.1, consola@^2.13.0, consola@^2.6.0, consola@^2.9.
resolved "https://registry.npmjs.org/consola/-/consola-2.13.0.tgz#5a4dc75e1b1fddbd8b10728e7790a2e54efeeeb7"
integrity sha512-Jw+8qpL0yrpfqH9m90fWoDRQyn8TYU6Aegpl4UofoP81VYvQLoOWMpFw2vQ3U/cyLRRzTc/CyNC6YYVzZFU8Eg==
+consola@^2.14.0:
+ version "2.14.0"
+ resolved "https://registry.npmjs.org/consola/-/consola-2.14.0.tgz#162ee903b6c9c4de25077d93f34ab902ebcb4dac"
+ integrity sha512-A2j1x4u8d6SIVikhZROfpFJxQZie+cZOfQMyI/tu2+hWXe8iAv7R6FW6s6x04/7zBCst94lPddztot/d6GJiuQ==
+
console-browserify@^1.1.0:
version "1.2.0"
resolved "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336"
@@ -10849,10 +10866,10 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
-puppeteer-core@^4.0.0:
- version "4.0.0"
- resolved "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-4.0.0.tgz#32cb3c97efd280301a8084caf5566b5c2d83896f"
- integrity sha512-Tb5FVp9h9wkd2gXpc/qfBFFI7zjLxxe3pw34U5ntpSnIoUV2m9IKIjAf7ou+5N3fU9VPV3MNJ3HQiDVasN/MPQ==
+puppeteer-core@^4.0.1:
+ version "4.0.1"
+ resolved "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-4.0.1.tgz#d6026add5fe058de22cd80879967eaa5e9be4cfb"
+ integrity sha512-8OfHmUkEXU/k7Bmcdm6KRWhIIfmayv/ce1AUDkP0nTLK2IpjulFggxq1dZhWgWHXebeLILbieMvAor7tSf3EqQ==
dependencies:
debug "^4.1.0"
extract-zip "^2.0.0"