Skip to content

Commit

Permalink
chore: update nuxt.config.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
NexZhu committed Oct 27, 2022
1 parent e7f0040 commit 2395059
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 43 deletions.
2 changes: 1 addition & 1 deletion generated/vue-components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
ElButton: typeof import('element-plus/dist/index.full.js')['ElButton']
ElButton: typeof import('element-plus/lib')['ElButton']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
Expand Down
41 changes: 27 additions & 14 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ElementPlusResolver } from '@daotl/unplugin-vue-components/resolvers'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

const lifecycle = process.env.npm_lifecycle_event

const elementPlusResolver = ElementPlusResolver({
nuxt: true,
ssr: true,
directives: false,
})
Expand All @@ -16,18 +15,39 @@ const autoImportOpts = {
// custom
{},
],
// dirs: ['generated/typed-router'],
resolvers: [elementPlusResolver],
dts: './generated/auto-imports.d.ts',
vueTemplate: true,
}

const vueComponentsOpts = {
resolvers: [ElementPlusResolver({ nuxt: true, ssr: true })],
resolvers: [elementPlusResolver],
dts: './generated/vue-components.d.ts',
}

export default defineNuxtConfig({
// Without this option, `rootDir` was incorrectly set to `web/frontend/web-frontend` because of pnpm workspace
// rootDir: '.',
/**
* Used to set the modules directories for path resolving (for example, webpack's `resolveLoading`, `nodeExternals` and `postcss`).
* The configuration path is relative to `options.rootDir` (default is current working directory).
* Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository.
* default: ["/<rootDir>/node_modules","/home/pooya/Code/framework/packages/schema/node_modules"]
*/
// modulesDir: ['/<rootDir>/node_modules', '../../node_modules'],
// ssr: false,
// sourcemap: false,
// nitro: {
// esbuild: {
// options: {
// minify: false,
// },
// },
// },
// alias: {
// '@common': path.resolve(__dirname, '../common/src'),
// '@backend': path.resolve(__dirname, '../backend/src'),
// },
imports: {
dirs: [
'generated/typed-router',
Expand All @@ -52,16 +72,11 @@ export default defineNuxtConfig({
],
build: {
transpile: [
// https://github.com/element-plus/element-plus-nuxt-starter/commit/09c84c050fae55600957cd89dba143ba8363fed0#diff-5977891bf10802cdd3cde62f0355105a1662e65b02ae4fb404a27bb0f5f53a07
'element-plus/es',
// Fix error: "[nuxt] [request error] [unhandled] [500] Cannot find module './internal/Observable'"
// https://github.com/nuxt/framework/discussions/7772#discussioncomment-3970252
'rxjs',
// https://github.com/element-plus/element-plus-nuxt-starter/blob/44644788ee0d2a2580769769f9885b5cd9f7c0ab/nuxt.config.ts#L27
...(lifecycle === 'build' || lifecycle === 'generate'
? ['element-plus']
: []),
// Already solved by setting `nuxt: true, ssr: true` to `ElementPlusResolver`
// For importing 'element-plus/es/components/xxx/style/css' to work
// 'element-plus/es',
],
},
experimental: {
Expand Down Expand Up @@ -113,9 +128,6 @@ export default defineNuxtConfig({
// },
// },
// vite: {
// plugins: [],
// },
// vite: {
// server: {
// proxy: {
// // https://github.com/nuxt/framework/discussions/1223#discussioncomment-3113141
Expand All @@ -126,6 +138,7 @@ export default defineNuxtConfig({
// },
// },
// },
// plugins: [],
// },

// https://github.com/nuxt/framework/issues/6204#issuecomment-1201398080
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
},
"devDependencies": {
"@daotl/eslint-config-vue": "^0.3.32",
"@daotl/unplugin-vue-components": "^0.22.7",
"@graphql-codegen/cli": "^2.13.7",
"@graphql-codegen/near-operation-file-preset": "^2.4.3",
"@graphql-codegen/typed-document-node": "^2.3.5",
Expand Down
27 changes: 0 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2395059

Please sign in to comment.