mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 00:52:01 +00:00
refactor structure and fix ts errors
This commit is contained in:
parent
a74b48c648
commit
cdc42133c7
@ -4,6 +4,7 @@ import chokidar from 'chokidar'
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import fsExtra from 'fs-extra'
|
import fsExtra from 'fs-extra'
|
||||||
import Glob from 'glob'
|
import Glob from 'glob'
|
||||||
|
import globby from 'globby'
|
||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import pify from 'pify'
|
import pify from 'pify'
|
||||||
import upath from 'upath'
|
import upath from 'upath'
|
||||||
@ -15,8 +16,7 @@ import template from 'lodash/template'
|
|||||||
import uniq from 'lodash/uniq'
|
import uniq from 'lodash/uniq'
|
||||||
import uniqBy from 'lodash/uniqBy'
|
import uniqBy from 'lodash/uniqBy'
|
||||||
|
|
||||||
import { BundleBuilder } from 'nuxt/webpack'
|
import { BundleBuilder } from 'src/webpack'
|
||||||
import vueAppTemplate from 'nuxt/vue-app/template'
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
r,
|
r,
|
||||||
@ -29,7 +29,7 @@ import {
|
|||||||
scanRequireTree,
|
scanRequireTree,
|
||||||
TARGETS,
|
TARGETS,
|
||||||
isFullStatic
|
isFullStatic
|
||||||
} from 'nuxt/utils'
|
} from 'src/utils'
|
||||||
|
|
||||||
import Ignore from './ignore'
|
import Ignore from './ignore'
|
||||||
import BuildContext from './context/build'
|
import BuildContext from './context/build'
|
||||||
@ -77,8 +77,7 @@ export default class Builder {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve template
|
this.resolveAppTemplate()
|
||||||
this.template = vueAppTemplate
|
|
||||||
|
|
||||||
// Create a new bundle builder
|
// Create a new bundle builder
|
||||||
this.bundleBuilder = this.getBundleBuilder(bundleBuilder)
|
this.bundleBuilder = this.getBundleBuilder(bundleBuilder)
|
||||||
@ -97,6 +96,18 @@ export default class Builder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolveAppTemplate() {
|
||||||
|
// Resolve appDir
|
||||||
|
const templatesDir = path.join(this.options.appDir, '_templates')
|
||||||
|
const files = globby.sync(path.join(templatesDir, '/**'))
|
||||||
|
.map(f => f.replace(templatesDir + path.sep, ''))
|
||||||
|
this.template = {
|
||||||
|
dependencies: {},
|
||||||
|
dir: templatesDir,
|
||||||
|
files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getBundleBuilder () {
|
getBundleBuilder () {
|
||||||
const context = new BuildContext(this)
|
const context = new BuildContext(this)
|
||||||
return new BundleBuilder(context)
|
return new BundleBuilder(context)
|
||||||
@ -169,7 +180,7 @@ export default class Builder {
|
|||||||
// Generate routes and interpret the template files
|
// Generate routes and interpret the template files
|
||||||
await this.generateRoutesAndFiles()
|
await this.generateRoutesAndFiles()
|
||||||
|
|
||||||
// Add vue-app template dir to watchers
|
// Add app template dir to watchers
|
||||||
this.options.build.watch.push(this.globPathWithExtensions(this.template.dir))
|
this.options.build.watch.push(this.globPathWithExtensions(this.template.dir))
|
||||||
|
|
||||||
await this.resolvePlugins()
|
await this.resolvePlugins()
|
||||||
@ -336,7 +347,7 @@ export default class Builder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async resolveApp ({ templateVars }) {
|
async resolveApp ({ templateVars }) {
|
||||||
templateVars.appPath = 'nuxt-app/app.tutorial.vue'
|
templateVars.appPath = 'app/app.tutorial.vue'
|
||||||
|
|
||||||
for (const appFile of this.appFiles) {
|
for (const appFile of this.appFiles) {
|
||||||
if (await fsExtra.exists(appFile)) {
|
if (await fsExtra.exists(appFile)) {
|
||||||
@ -503,7 +514,7 @@ export default class Builder {
|
|||||||
// Modules & user provided templates
|
// Modules & user provided templates
|
||||||
// first custom to keep their index
|
// first custom to keep their index
|
||||||
...customTemplateFiles,
|
...customTemplateFiles,
|
||||||
// @nuxt/vue-app templates
|
// @nuxt/app templates
|
||||||
...templateContext.templateFiles
|
...templateContext.templateFiles
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import uniqBy from 'lodash/uniqBy'
|
|||||||
import serialize from 'serialize-javascript'
|
import serialize from 'serialize-javascript'
|
||||||
|
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { r, wp, wChunk, serializeFunction, isFullStatic } from 'nuxt/utils'
|
import { r, wp, wChunk, serializeFunction, isFullStatic } from 'src/utils'
|
||||||
|
|
||||||
export default class TemplateContext {
|
export default class TemplateContext {
|
||||||
constructor(builder, options) {
|
constructor(builder, options) {
|
||||||
|
@ -8,9 +8,9 @@ import { forceExit } from './utils'
|
|||||||
import { loadNuxtConfig } from './utils/config'
|
import { loadNuxtConfig } from './utils/config'
|
||||||
import { indent, foldLines, colorize } from './utils/formatting'
|
import { indent, foldLines, colorize } from './utils/formatting'
|
||||||
import { startSpaces, optionSpaces, forceExitTimeout } from './utils/constants'
|
import { startSpaces, optionSpaces, forceExitTimeout } from './utils/constants'
|
||||||
import { Nuxt } from 'nuxt/core'
|
import { Nuxt } from 'src/core'
|
||||||
import { Builder } from 'nuxt/builder'
|
import { Builder } from 'src/builder'
|
||||||
import { Generator } from 'nuxt/generator'
|
import { Generator } from 'src/generator'
|
||||||
|
|
||||||
export default class NuxtCommand extends Hookable {
|
export default class NuxtCommand extends Hookable {
|
||||||
constructor (cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2), hooks = {}) {
|
constructor (cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2), hooks = {}) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { MODES, TARGETS } from 'nuxt/utils'
|
import { MODES, TARGETS } from 'src/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { createLock } from '../utils'
|
import { createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { TARGETS } from 'nuxt/utils'
|
import { TARGETS } from 'src/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { createLock } from '../utils'
|
import { createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TARGETS } from 'nuxt/utils'
|
import { TARGETS } from 'src/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { normalizeArg, createLock } from '../utils'
|
import { normalizeArg, createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@ import { join, extname, basename } from 'path'
|
|||||||
import connect from 'connect'
|
import connect from 'connect'
|
||||||
import serveStatic from 'serve-static'
|
import serveStatic from 'serve-static'
|
||||||
import compression from 'compression'
|
import compression from 'compression'
|
||||||
import { getNuxtConfig } from 'nuxt/config'
|
import { getNuxtConfig } from 'src/config'
|
||||||
import { TARGETS } from 'nuxt/utils'
|
import { TARGETS } from 'src/utils'
|
||||||
import { common, server } from '../options'
|
import { common, server } from '../options'
|
||||||
import { showBanner } from '../utils/banner'
|
import { showBanner } from '../utils/banner'
|
||||||
import { Listener } from 'nuxt/server'
|
import { Listener } from 'src/server'
|
||||||
import { Nuxt } from 'nuxt/core'
|
import { Nuxt } from 'src/core'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'serve',
|
name: 'serve',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TARGETS } from 'nuxt/utils'
|
import { TARGETS } from 'src/utils'
|
||||||
import { common, server } from '../options'
|
import { common, server } from '../options'
|
||||||
import { showBanner } from '../utils/banner'
|
import { showBanner } from '../utils/banner'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defaultNuxtConfigFile } from 'nuxt/config'
|
import { defaultNuxtConfigFile } from 'src/config'
|
||||||
import { normalizeArg } from '../utils'
|
import { normalizeArg } from '../utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import defaultsDeep from 'lodash/defaultsDeep'
|
import defaultsDeep from 'lodash/defaultsDeep'
|
||||||
import { loadNuxtConfig as _loadNuxtConfig, getDefaultNuxtConfig } from 'nuxt/config'
|
import { loadNuxtConfig as _loadNuxtConfig, getDefaultNuxtConfig } from 'src/config'
|
||||||
import { MODES } from 'nuxt/utils'
|
import { MODES } from 'src/utils'
|
||||||
|
|
||||||
export async function loadNuxtConfig (argv, configContext) {
|
export async function loadNuxtConfig (argv, configContext) {
|
||||||
const rootDir = path.resolve(argv._[0] || '.')
|
const rootDir = path.resolve(argv._[0] || '.')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import exit from 'exit'
|
import exit from 'exit'
|
||||||
|
|
||||||
import { lock } from 'nuxt/utils'
|
import { lock } from 'src/utils'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import { warningBox } from './formatting'
|
import { warningBox } from './formatting'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { loadNuxt } from 'nuxt/core'
|
import { loadNuxt } from 'src/core'
|
||||||
import { getBuilder } from 'nuxt/builder'
|
import { getBuilder } from 'src/builder'
|
||||||
|
|
||||||
export async function getWebpackConfig(name = 'client', loadOptions = {}) {
|
export async function getWebpackConfig(name = 'client', loadOptions = {}) {
|
||||||
const nuxt = await loadNuxt(loadOptions)
|
const nuxt = await loadNuxt(loadOptions)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import capitalize from 'lodash/capitalize'
|
import capitalize from 'lodash/capitalize'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import { TARGETS, MODES } from 'nuxt/utils'
|
import path from 'path'
|
||||||
|
import { TARGETS, MODES } from 'src/utils'
|
||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
// Env
|
// Env
|
||||||
@ -47,6 +48,7 @@ export default () => ({
|
|||||||
modulesDir: [
|
modulesDir: [
|
||||||
'node_modules'
|
'node_modules'
|
||||||
],
|
],
|
||||||
|
appDir: path.resolve(__dirname, '../../../app'),
|
||||||
dir: {
|
dir: {
|
||||||
assets: 'assets',
|
assets: 'assets',
|
||||||
app: 'app',
|
app: 'app',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MODES } from 'nuxt/utils'
|
import { MODES } from 'src/utils'
|
||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
[MODES.universal]: {
|
[MODES.universal]: {
|
||||||
|
@ -3,7 +3,7 @@ import fs from 'fs'
|
|||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import { clearRequireCache, scanRequireTree } from 'nuxt/utils'
|
import { clearRequireCache, scanRequireTree } from 'src/utils'
|
||||||
import jiti from 'jiti'
|
import jiti from 'jiti'
|
||||||
import _createRequire from 'create-require'
|
import _createRequire from 'create-require'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
|
@ -6,7 +6,7 @@ import pick from 'lodash/pick'
|
|||||||
import uniq from 'lodash/uniq'
|
import uniq from 'lodash/uniq'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'nuxt/utils'
|
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'src/utils'
|
||||||
import { defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
|
import { defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
|
||||||
|
|
||||||
export function getNuxtConfig (_options) {
|
export function getNuxtConfig (_options) {
|
||||||
@ -413,6 +413,7 @@ export function getNuxtConfig (_options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
options.build.transpile = [].concat(options.build.transpile || [])
|
options.build.transpile = [].concat(options.build.transpile || [])
|
||||||
|
options.build.transpile.push('app')
|
||||||
|
|
||||||
if (options.build.quiet === true) {
|
if (options.build.quiet === true) {
|
||||||
consola.level = 0
|
consola.level = 0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export { default as Module } from './module'
|
export { default as Module } from './module'
|
||||||
export { default as Nuxt } from './nuxt'
|
export { default as Nuxt } from './nuxt'
|
||||||
export { default as Resolver } from './resolver'
|
export { default as Resolver } from './resolver'
|
||||||
export { loadNuxtConfig } from 'nuxt/config'
|
export { loadNuxtConfig } from 'src/config'
|
||||||
export { loadNuxt } from './load'
|
export { loadNuxt } from './load'
|
||||||
|
@ -3,7 +3,7 @@ import fs from 'fs'
|
|||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { chainFn, sequence } from 'nuxt/utils'
|
import { chainFn, sequence } from 'src/utils'
|
||||||
|
|
||||||
export default class ModuleContainer {
|
export default class ModuleContainer {
|
||||||
constructor (nuxt) {
|
constructor (nuxt) {
|
||||||
|
@ -3,9 +3,9 @@ import isPlainObject from 'lodash/isPlainObject'
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import Hookable from 'hable'
|
import Hookable from 'hable'
|
||||||
|
|
||||||
import { defineAlias } from 'nuxt/utils'
|
import { defineAlias } from 'src/utils'
|
||||||
import { getNuxtConfig } from 'nuxt/config'
|
import { getNuxtConfig } from 'src/config'
|
||||||
import { Server } from 'nuxt/server'
|
import { Server } from 'src/server'
|
||||||
|
|
||||||
import { version } from '../../package.json'
|
import { version } from '../../package.json'
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
startsWithSrcAlias,
|
startsWithSrcAlias,
|
||||||
isExternalDependency,
|
isExternalDependency,
|
||||||
clearRequireCache
|
clearRequireCache
|
||||||
} from 'nuxt/utils'
|
} from 'src/utils'
|
||||||
|
|
||||||
export default class Resolver {
|
export default class Resolver {
|
||||||
constructor (nuxt) {
|
constructor (nuxt) {
|
||||||
|
@ -6,7 +6,7 @@ import defu from 'defu'
|
|||||||
import htmlMinifier from 'html-minifier'
|
import htmlMinifier from 'html-minifier'
|
||||||
import { parse } from 'node-html-parser'
|
import { parse } from 'node-html-parser'
|
||||||
|
|
||||||
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS } from 'nuxt/utils'
|
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS } from 'src/utils'
|
||||||
|
|
||||||
export default class Generator {
|
export default class Generator {
|
||||||
constructor (nuxt, builder) {
|
constructor (nuxt, builder) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { timeout } from 'nuxt/utils'
|
import { timeout } from 'src/utils'
|
||||||
|
|
||||||
export default async function renderAndGetWindow (
|
export default async function renderAndGetWindow (
|
||||||
url = 'http://localhost:3000',
|
url = 'http://localhost:3000',
|
||||||
|
@ -2,7 +2,7 @@ import generateETag from 'etag'
|
|||||||
import fresh from 'fresh'
|
import fresh from 'fresh'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { getContext, TARGETS } from 'nuxt/utils'
|
import { getContext, TARGETS } from 'src/utils'
|
||||||
|
|
||||||
export default ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware (req, res, next) {
|
export default ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware (req, res, next) {
|
||||||
// Get context
|
// Get context
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import onHeaders from 'on-headers'
|
import onHeaders from 'on-headers'
|
||||||
import { Timer } from 'nuxt/utils'
|
import { Timer } from 'src/utils'
|
||||||
|
|
||||||
export default options => (req, res, next) => {
|
export default options => (req, res, next) => {
|
||||||
if (res.timing) {
|
if (res.timing) {
|
||||||
|
@ -4,8 +4,8 @@ import launchMiddleware from 'launch-editor-middleware'
|
|||||||
import serveStatic from 'serve-static'
|
import serveStatic from 'serve-static'
|
||||||
import servePlaceholder from 'serve-placeholder'
|
import servePlaceholder from 'serve-placeholder'
|
||||||
import connect from 'connect'
|
import connect from 'connect'
|
||||||
import { determineGlobals, isUrl } from 'nuxt/utils'
|
import { determineGlobals, isUrl } from 'src/utils'
|
||||||
import { VueRenderer } from 'nuxt/vue-renderer'
|
import { VueRenderer } from 'src/vue-renderer'
|
||||||
|
|
||||||
import ServerContext from './context'
|
import ServerContext from './context'
|
||||||
import renderAndGetWindow from './jsdom'
|
import renderAndGetWindow from './jsdom'
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
<template>
|
|
||||||
Has pages/ ? <nuxt-page />
|
|
||||||
Please create `pages/index.vue` or `app.vue`
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<nav>My navbar</nav>
|
|
||||||
<nuxt-page />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/*
|
|
||||||
my-project/app.vue -> no router needed
|
|
||||||
|
|
||||||
vs
|
|
||||||
|
|
||||||
my-project/pages/index.vue -> router needed and app.vue display
|
|
||||||
|
|
||||||
vue-app/dotnuxt/app.vue
|
|
||||||
|
|
||||||
Resolving App:
|
|
||||||
1. ~/app.vue (variable)
|
|
||||||
2. (if pages/) nuxt-app/app.pages.vue (Light with router)
|
|
||||||
3. nuxt-app/app.tutorial.vue
|
|
||||||
|
|
||||||
For layers:
|
|
||||||
create {srcDir}/app.vue:
|
|
||||||
<template>
|
|
||||||
<nuxt-layer>
|
|
||||||
|
|
||||||
app.starter.vue -- guiding to create app.vue or pages/
|
|
||||||
app.default.vue if (pages/)
|
|
||||||
app.layout.vue if (layouts/)
|
|
||||||
|
|
||||||
pages/index.vue:
|
|
||||||
<nuxt-layout>
|
|
||||||
...
|
|
||||||
</nuxt-layout>
|
|
||||||
|
|
||||||
pages/about.vue:
|
|
||||||
...
|
|
||||||
|
|
||||||
*/
|
|
||||||
</script>
|
|
@ -1 +0,0 @@
|
|||||||
// nothing here
|
|
@ -1,10 +0,0 @@
|
|||||||
declare module NodeJS {
|
|
||||||
interface Process {
|
|
||||||
browser: boolean
|
|
||||||
client: boolean
|
|
||||||
mode: 'spa' | 'universal'
|
|
||||||
modern: boolean
|
|
||||||
server: boolean
|
|
||||||
static: boolean
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
declare module 'nuxt-build/routes' {
|
|
||||||
import { RouteRecordRaw } from 'vue-router'
|
|
||||||
|
|
||||||
const _default: RouteRecordRaw[]
|
|
||||||
export default _default
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
interface Window {
|
|
||||||
__NUXT__?: Record<string, any>
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
export { init } from './nuxt'
|
|
@ -1,54 +0,0 @@
|
|||||||
import type { IncomingMessage, ServerResponse } from 'http'
|
|
||||||
import Hookable from 'hookable'
|
|
||||||
import type { App } from 'vue'
|
|
||||||
|
|
||||||
import type { Plugin } from './types'
|
|
||||||
import { defineGetter } from './utils'
|
|
||||||
|
|
||||||
export class Nuxt extends Hookable {
|
|
||||||
app: App<Element>
|
|
||||||
ssrContext?: Record<string, any>
|
|
||||||
globalName: string
|
|
||||||
context: {
|
|
||||||
req?: IncomingMessage
|
|
||||||
res?: ServerResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor ({ app, ssrContext, globalName }: { app: Nuxt['app'], ssrContext?: Nuxt['ssrContext'], globalName: Nuxt['globalName'] }) {
|
|
||||||
super()
|
|
||||||
this.app = app
|
|
||||||
this.ssrContext = ssrContext
|
|
||||||
this.globalName = globalName
|
|
||||||
}
|
|
||||||
|
|
||||||
provide (name: string, value: any) {
|
|
||||||
const $name = '$' + name
|
|
||||||
defineGetter(this.app, $name, value)
|
|
||||||
defineGetter(this.app.config.globalProperties, $name, value)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface InitOptions {
|
|
||||||
app: Nuxt['app']
|
|
||||||
plugins?: Plugin[]
|
|
||||||
ssrContext?: Nuxt['ssrContext']
|
|
||||||
globalName?: Nuxt['globalName']
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function init ({ app, plugins, ssrContext, globalName = 'nuxt' }: InitOptions) {
|
|
||||||
const nuxt = new Nuxt({ app, ssrContext, globalName })
|
|
||||||
nuxt.provide('nuxt', nuxt)
|
|
||||||
|
|
||||||
const inject: Nuxt['provide'] = nuxt.provide.bind(nuxt)
|
|
||||||
|
|
||||||
for (const plugin of plugins) {
|
|
||||||
await plugin(nuxt, inject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module 'vue' {
|
|
||||||
interface App {
|
|
||||||
$nuxt: Nuxt
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
import { createSSRApp } from 'vue'
|
|
||||||
import { init } from 'nuxt-app'
|
|
||||||
import plugins from './plugins.client'
|
|
||||||
import App from '<%= appPath %>'
|
|
||||||
|
|
||||||
async function initApp () {
|
|
||||||
const app = createSSRApp(App)
|
|
||||||
|
|
||||||
await init({
|
|
||||||
app,
|
|
||||||
plugins
|
|
||||||
})
|
|
||||||
|
|
||||||
await app.$nuxt.callHook('client:create')
|
|
||||||
|
|
||||||
app.mount('#__nuxt')
|
|
||||||
|
|
||||||
await app.$nuxt.callHook('client:mounted')
|
|
||||||
|
|
||||||
console.log('App ready:', app) // eslint-disable-line no-console
|
|
||||||
}
|
|
||||||
|
|
||||||
initApp().catch((error) => {
|
|
||||||
console.error('Error while mounting app:', error) // eslint-disable-line no-console
|
|
||||||
})
|
|
@ -1,19 +0,0 @@
|
|||||||
import { createApp } from 'vue'
|
|
||||||
|
|
||||||
import { init } from 'nuxt-app'
|
|
||||||
import plugins from 'nuxt-build/plugins.server'
|
|
||||||
import App from '<%= appPath %>'
|
|
||||||
|
|
||||||
export default async function createNuxtAppServer (ssrContext = {}) {
|
|
||||||
const app = createApp(App)
|
|
||||||
|
|
||||||
await init({
|
|
||||||
app,
|
|
||||||
plugins,
|
|
||||||
ssrContext
|
|
||||||
})
|
|
||||||
|
|
||||||
await app.$nuxt.callHook('server:create')
|
|
||||||
|
|
||||||
return app
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Nuxt />
|
|
||||||
</template>
|
|
@ -1,5 +0,0 @@
|
|||||||
import sharedPlugins from './plugins'
|
|
||||||
|
|
||||||
export default [
|
|
||||||
...sharedPlugins
|
|
||||||
]
|
|
@ -1,7 +0,0 @@
|
|||||||
import preload from 'nuxt-app/plugins/preload'
|
|
||||||
import sharedPlugins from './plugins'
|
|
||||||
|
|
||||||
export default [
|
|
||||||
...sharedPlugins,
|
|
||||||
preload
|
|
||||||
]
|
|
@ -1,11 +0,0 @@
|
|||||||
// import router from 'nuxt-app/plugins/router'
|
|
||||||
import state from 'nuxt-app/plugins/state'
|
|
||||||
import components from 'nuxt-app/plugins/components'
|
|
||||||
import legacy from 'nuxt-app/plugins/legacy'
|
|
||||||
|
|
||||||
export default [
|
|
||||||
// router,
|
|
||||||
state,
|
|
||||||
components,
|
|
||||||
legacy
|
|
||||||
]
|
|
@ -1,19 +0,0 @@
|
|||||||
const Index = () => import('~/pages' /* webpackChunkName: "Home" */)
|
|
||||||
const About = () => import('~/pages/about' /* webpackChunkName: "About" */)
|
|
||||||
const Custom = () => import('~/pages/custom' /* webpackChunkName: "Custom" */)
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
__file: '@/pages/index.vue',
|
|
||||||
component: Index
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/about',
|
|
||||||
component: About
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/custom',
|
|
||||||
component: Custom
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,9 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html {{ HTML_ATTRS }}>
|
|
||||||
<head {{ HEAD_ATTRS }}>
|
|
||||||
{{ HEAD }}
|
|
||||||
</head>
|
|
||||||
<body {{ BODY_ATTRS }}>
|
|
||||||
<div id="__nuxt">{{ APP }}</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Server error</title>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>
|
|
||||||
<style>
|
|
||||||
.__nuxt-error-page{padding: 1rem;background:#f7f8fb;color:#47494e;text-align:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;font-family:sans-serif;font-weight:100!important;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-font-smoothing:antialiased;position:absolute;top:0;left:0;right:0;bottom:0}.__nuxt-error-page .error{max-width:450px}.__nuxt-error-page .title{font-size:24px;font-size:1.5rem;margin-top:15px;color:#47494e;margin-bottom:8px}.__nuxt-error-page .description{color:#7f828b;line-height:21px;margin-bottom:10px}.__nuxt-error-page a{color:#7f828b!important;text-decoration:none}.__nuxt-error-page .logo{position:fixed;left:12px;bottom:12px}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="__nuxt-error-page">
|
|
||||||
<div class="error">
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
|
|
||||||
<div class="title">Server error</div>
|
|
||||||
<div class="description">{{ message }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="logo">
|
|
||||||
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,15 +0,0 @@
|
|||||||
import type { Plugin } from 'nuxt/vue-app/types'
|
|
||||||
|
|
||||||
// import { h, defineComponent } from 'vue'
|
|
||||||
import { RouterLink } from 'vue-router'
|
|
||||||
|
|
||||||
// const NuxtLink = defineComponent({
|
|
||||||
// extends: Link
|
|
||||||
// })
|
|
||||||
|
|
||||||
const components: Plugin = function ({ app }) {
|
|
||||||
app.component('NuxtLink', RouterLink)
|
|
||||||
app.component('NLink', RouterLink) // TODO: deprecate
|
|
||||||
}
|
|
||||||
|
|
||||||
export default components
|
|
@ -1,20 +0,0 @@
|
|||||||
import type { App } from 'vue'
|
|
||||||
import type { Plugin } from 'nuxt/vue-app/types'
|
|
||||||
|
|
||||||
const legacy: Plugin = function ({ app }) {
|
|
||||||
app.$nuxt.context = {}
|
|
||||||
|
|
||||||
if (process.client) {
|
|
||||||
const legacyApp: App<Element> & { $root?: App<Element> } = { ...app }
|
|
||||||
legacyApp.$root = legacyApp
|
|
||||||
window[app.$nuxt.globalName] = legacyApp
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.server) {
|
|
||||||
const { ssrContext } = app.$nuxt
|
|
||||||
app.$nuxt.context.req = ssrContext.req
|
|
||||||
app.$nuxt.context.res = ssrContext.res
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default legacy
|
|
@ -1,13 +0,0 @@
|
|||||||
import type { Plugin } from 'nuxt/vue-app/types'
|
|
||||||
|
|
||||||
const preload: Plugin = function ({ app }) {
|
|
||||||
app.mixin({
|
|
||||||
beforeCreate () {
|
|
||||||
const { _registeredComponents } = this.$nuxt.ssrContext
|
|
||||||
const { __moduleIdentifier } = this.$options
|
|
||||||
_registeredComponents.push(__moduleIdentifier)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default preload
|
|
@ -1,41 +0,0 @@
|
|||||||
import { ref } from 'vue'
|
|
||||||
import { createRouter, createWebHistory, createMemoryHistory } from 'vue-router'
|
|
||||||
|
|
||||||
import type { Plugin } from 'nuxt/vue-app/types'
|
|
||||||
|
|
||||||
import routes from 'nuxt-build/routes'
|
|
||||||
|
|
||||||
const router: Plugin = function ({ app }) {
|
|
||||||
const routerHistory = process.client
|
|
||||||
? createWebHistory()
|
|
||||||
: createMemoryHistory()
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: routerHistory,
|
|
||||||
routes
|
|
||||||
})
|
|
||||||
app.use(router)
|
|
||||||
|
|
||||||
const previousRoute = ref()
|
|
||||||
router.afterEach((to, from) => {
|
|
||||||
previousRoute.value = from
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.defineProperty(app.config.globalProperties, 'previousRoute', {
|
|
||||||
get: () => previousRoute.value
|
|
||||||
})
|
|
||||||
|
|
||||||
if (process.server) {
|
|
||||||
app.$nuxt.hook('server:create', async () => {
|
|
||||||
router.push(app.$nuxt.ssrContext.url)
|
|
||||||
await router.isReady()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
app.$nuxt.hook('client:create', async () => {
|
|
||||||
router.push(router.history.location.fullPath)
|
|
||||||
await router.isReady()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default router
|
|
@ -1,17 +0,0 @@
|
|||||||
import type { Plugin } from 'nuxt/vue-app/types'
|
|
||||||
|
|
||||||
const state: Plugin = function ({ app }) {
|
|
||||||
if (process.server) {
|
|
||||||
app.$nuxt.state = {
|
|
||||||
serverRendered: true
|
|
||||||
// data, fetch, vuex, etc.
|
|
||||||
}
|
|
||||||
app.$nuxt.ssrContext.nuxt = app.$nuxt.state
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.client) {
|
|
||||||
app.$nuxt.state = window.__NUXT__ || {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default state
|
|
@ -1,12 +0,0 @@
|
|||||||
import path from 'path'
|
|
||||||
import globby from 'globby'
|
|
||||||
|
|
||||||
const dir = path.join(__dirname, 'nuxt')
|
|
||||||
const files = globby.sync(path.join(dir, '/**'))
|
|
||||||
.map(f => f.replace(dir + path.sep, '')) // TODO: workaround
|
|
||||||
|
|
||||||
export default {
|
|
||||||
dependencies: {},
|
|
||||||
dir,
|
|
||||||
files
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
import type { Nuxt } from './nuxt';
|
|
||||||
|
|
||||||
export interface Plugin {
|
|
||||||
(nuxt: Nuxt, inject?: Nuxt['provide']): Promise<void> | void
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
export function defineGetter<K extends string | number | symbol, V> (obj: Record<K, V>, key: K, val: V) {
|
|
||||||
Object.defineProperty(obj, key, { get: () => val })
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
{
|
|
||||||
"nuxtChildKey": {
|
|
||||||
"description": "This prop will be set to <router-view/>, useful to make transitions inside a dynamic page and different route. Default: `$route.fullPath`"
|
|
||||||
},
|
|
||||||
"to": {
|
|
||||||
"description": "Denotes the target route of the link. When clicked, the value of the to prop will be passed to router.push() internally, so the value can be either a string or a location descriptor object."
|
|
||||||
},
|
|
||||||
"prefetch": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Prefetch route target (overrides router.prefetchLinks value in nuxt.config.js)."
|
|
||||||
},
|
|
||||||
"no-prefetch": {
|
|
||||||
"description": "Avoid prefetching route target."
|
|
||||||
},
|
|
||||||
"replace": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Setting replace prop will call router.replace() instead of router.push() when clicked, so the navigation will not leave a history record."
|
|
||||||
},
|
|
||||||
"append": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Setting append prop always appends the relative path to the current path. For example, assuming we are navigating from /a to a relative link b, without append we will end up at /b, but with append we will end up at /a/b."
|
|
||||||
},
|
|
||||||
"tag": {
|
|
||||||
"description": "Specify which tag to render to, and it will still listen to click events for navigation."
|
|
||||||
},
|
|
||||||
"active-class": {
|
|
||||||
"description": "Configure the active CSS class applied when the link is active."
|
|
||||||
},
|
|
||||||
"exact": {
|
|
||||||
"description": "The default active class matching behavior is inclusive match. For example, <router-link to=\"/a\"> will get this class applied as long as the current path starts with /a/ or is /a.\nOne consequence of this is that <router-link to=\"/\"> will be active for every route! To force the link into \"exact match mode\", use the exact prop: <router-link to=\"/\" exact>"
|
|
||||||
},
|
|
||||||
"event": {
|
|
||||||
"description": "Specify the event(s) that can trigger the link navigation."
|
|
||||||
},
|
|
||||||
"exact-active-class": {
|
|
||||||
"description": "Configure the active CSS class applied when the link is active with exact match. Note the default value can also be configured globally via the linkExactActiveClass router constructor option."
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"nuxt": {
|
|
||||||
"attributes": [
|
|
||||||
"nuxtChildKey"
|
|
||||||
],
|
|
||||||
"description": "Component to render the current nuxt page."
|
|
||||||
},
|
|
||||||
"n-child": {
|
|
||||||
"description": "Component for displaying the children components in a nested route."
|
|
||||||
},
|
|
||||||
"nuxt-child": {
|
|
||||||
"description": "Component for displaying the children components in a nested route."
|
|
||||||
},
|
|
||||||
"n-link": {
|
|
||||||
"attributes": [
|
|
||||||
"to",
|
|
||||||
"replace",
|
|
||||||
"append",
|
|
||||||
"tag",
|
|
||||||
"active-class",
|
|
||||||
"exact",
|
|
||||||
"event",
|
|
||||||
"exact-active-class",
|
|
||||||
"prefetch",
|
|
||||||
"no-prefetch"
|
|
||||||
],
|
|
||||||
"description": "Component for navigating between Nuxt pages."
|
|
||||||
},
|
|
||||||
"nuxt-link": {
|
|
||||||
"attributes": [
|
|
||||||
"to",
|
|
||||||
"replace",
|
|
||||||
"append",
|
|
||||||
"tag",
|
|
||||||
"active-class",
|
|
||||||
"exact",
|
|
||||||
"event",
|
|
||||||
"exact-active-class",
|
|
||||||
"prefetch",
|
|
||||||
"no-prefetch"
|
|
||||||
],
|
|
||||||
"description": "Component for navigating between Nuxt pages."
|
|
||||||
},
|
|
||||||
"no-ssr": {
|
|
||||||
"description": "Component for excluding a part of your app from server-side rendering."
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ import path from 'path'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import template from 'lodash/template'
|
import template from 'lodash/template'
|
||||||
import { TARGETS, isModernRequest, waitFor } from 'nuxt/utils'
|
import { TARGETS, isModernRequest, waitFor } from 'src/utils'
|
||||||
|
|
||||||
import SPARenderer from './renderers/spa'
|
import SPARenderer from './renderers/spa'
|
||||||
import SSRRenderer from './renderers/ssr'
|
import SSRRenderer from './renderers/ssr'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { isUrl, urlJoin, safariNoModuleFix } from 'nuxt/utils'
|
import { isUrl, urlJoin, safariNoModuleFix } from 'src/utils'
|
||||||
import SSRRenderer from './ssr'
|
import SSRRenderer from './ssr'
|
||||||
|
|
||||||
export default class ModernRenderer extends SSRRenderer {
|
export default class ModernRenderer extends SSRRenderer {
|
||||||
|
@ -3,7 +3,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
|||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
import LRU from 'lru-cache'
|
import LRU from 'lru-cache'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { TARGETS, isModernRequest } from 'nuxt/utils'
|
import { TARGETS, isModernRequest } from 'src/utils'
|
||||||
import BaseRenderer from './base'
|
import BaseRenderer from './base'
|
||||||
|
|
||||||
export default class SPARenderer extends BaseRenderer {
|
export default class SPARenderer extends BaseRenderer {
|
||||||
|
@ -3,7 +3,7 @@ import crypto from 'crypto'
|
|||||||
import { format } from 'util'
|
import { format } from 'util'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { TARGETS, urlJoin } from 'nuxt/utils'
|
import { TARGETS, urlJoin } from 'src/utils'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { createBundleRenderer } from 'vue-bundle-renderer'
|
import { createBundleRenderer } from 'vue-bundle-renderer'
|
||||||
import BaseRenderer from './base'
|
import BaseRenderer from './base'
|
||||||
|
@ -6,7 +6,7 @@ import webpackDevMiddleware from 'webpack-dev-middleware'
|
|||||||
import webpackHotMiddleware from 'webpack-hot-middleware'
|
import webpackHotMiddleware from 'webpack-hot-middleware'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { TARGETS, parallel, sequence, wrapArray, isModernRequest } from 'nuxt/utils'
|
import { TARGETS, parallel, sequence, wrapArray, isModernRequest } from 'src/utils'
|
||||||
import { createMFS } from './utils/mfs'
|
import { createMFS } from './utils/mfs'
|
||||||
|
|
||||||
import * as WebpackConfigs from './config'
|
import * as WebpackConfigs from './config'
|
||||||
|
@ -9,7 +9,7 @@ import TerserWebpackPlugin from 'terser-webpack-plugin'
|
|||||||
import WebpackBar from 'webpackbar'
|
import WebpackBar from 'webpackbar'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import semver from 'semver'
|
import semver from 'semver'
|
||||||
import { TARGETS, isUrl, urlJoin, getPKG } from 'nuxt/utils'
|
import { TARGETS, isUrl, urlJoin, getPKG } from 'src/utils'
|
||||||
import PerfLoader from '../utils/perf-loader'
|
import PerfLoader from '../utils/perf-loader'
|
||||||
import StyleLoader from '../utils/style-loader'
|
import StyleLoader from '../utils/style-loader'
|
||||||
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
||||||
@ -258,7 +258,7 @@ export default class WebpackBaseConfig {
|
|||||||
alias () {
|
alias () {
|
||||||
return {
|
return {
|
||||||
...this.buildContext.options.alias,
|
...this.buildContext.options.alias,
|
||||||
'nuxt-app': path.dirname(require.resolve('../../vue-app')),
|
'app': this.buildContext.options.appDir,
|
||||||
'nuxt-build': this.buildContext.options.buildDir,
|
'nuxt-build': this.buildContext.options.buildDir,
|
||||||
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
|
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ export default class WebpackBaseConfig {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.m?jsx?$/i,
|
test: /\.m?[jt]sx?$/i,
|
||||||
exclude: (file) => {
|
exclude: (file) => {
|
||||||
file = file.split('node_modules', 2)[1]
|
file = file.split('node_modules', 2)[1]
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import EventEmitter from 'events'
|
import EventEmitter from 'events'
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
||||||
import { safariNoModuleFix } from 'nuxt/utils'
|
import { safariNoModuleFix } from 'src/utils'
|
||||||
|
|
||||||
const assetsMap = {}
|
const assetsMap = {}
|
||||||
const watcher = new EventEmitter()
|
const watcher = new EventEmitter()
|
||||||
|
@ -6,7 +6,7 @@ import merge from 'lodash/merge'
|
|||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import createResolver from 'postcss-import-resolver'
|
import createResolver from 'postcss-import-resolver'
|
||||||
|
|
||||||
import { isPureObject } from 'nuxt/utils'
|
import { isPureObject } from 'src/utils'
|
||||||
|
|
||||||
export const orderPresets = {
|
export const orderPresets = {
|
||||||
cssnanoLast (names) {
|
cssnanoLast (names) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import ExtractCssChunksPlugin from 'extract-css-chunks-webpack-plugin'
|
import ExtractCssChunksPlugin from 'extract-css-chunks-webpack-plugin'
|
||||||
|
|
||||||
import { wrapArray } from 'nuxt/utils'
|
import { wrapArray } from 'src/utils'
|
||||||
|
|
||||||
import PostcssConfig from './postcss'
|
import PostcssConfig from './postcss'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user