diff --git a/docs/content/en/getting-started-nuxt.md b/docs/content/en/getting-started-nuxt.md index c18c63a..d83ee86 100644 --- a/docs/content/en/getting-started-nuxt.md +++ b/docs/content/en/getting-started-nuxt.md @@ -43,16 +43,6 @@ position: 2 -3. You will need to transpile this module, by adding the following to your `nuxt.config`: - - ```ts{}[nuxt.config.js] - build: { - transpile: [ - /typed-vuex/, - ], - }, - ``` - ## Add type definitions The module will inject a store accessor throughout your project (`$accessor`). It is not typed by default, so you will need to add types. diff --git a/examples/nuxt-ts/nuxt.config.ts b/examples/nuxt-ts/nuxt.config.ts index 8ae7eef..ebb61fe 100644 --- a/examples/nuxt-ts/nuxt.config.ts +++ b/examples/nuxt-ts/nuxt.config.ts @@ -1,52 +1,10 @@ import { Configuration } from '@nuxt/types' const config: Configuration = { - mode: 'universal', - /* - ** Headers of the page - */ - head: { - title: process.env.npm_package_name || '', - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { - hid: 'description', - name: 'description', - content: process.env.npm_package_description || '', - }, - ], - link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], - }, - /* - ** Customize the progress-bar color - */ - loading: { color: '#fff' }, - /* - ** Global CSS - */ - css: [], - /* - ** Plugins to load before mounting the App - */ - plugins: [], /* ** Nuxt.js dev-modules */ buildModules: ['@nuxt/typescript-build', 'nuxt-typed-vuex'], - /* - ** Nuxt.js modules - */ - modules: [], - /* - ** Build configuration - */ - build: { - /* - ** Transpile module (and plugin). - */ - transpile: [/typed-vuex/], - }, } export default config diff --git a/examples/nuxt/nuxt.config.js b/examples/nuxt/nuxt.config.js index a93551d..75481b2 100644 --- a/examples/nuxt/nuxt.config.js +++ b/examples/nuxt/nuxt.config.js @@ -1,29 +1,4 @@ export default { - mode: 'universal', - /* - ** Headers of the page - */ - head: { - title: process.env.npm_package_name || '', - meta: [ - { charset: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { - hid: 'description', - name: 'description', - content: process.env.npm_package_description || '', - }, - ], - link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], - }, - /* - ** Customize the progress-bar color - */ - loading: { color: '#fff' }, - /* - ** Global CSS - */ - css: [], /* ** Plugins to load before mounting the App */ @@ -32,17 +7,4 @@ export default { ** Nuxt.js dev-modules */ buildModules: ['@nuxt/typescript-build', 'nuxt-typed-vuex'], - /* - ** Nuxt.js modules - */ - modules: [], - /* - ** Build configuration - */ - build: { - /* - ** Transpile module (and plugin). - */ - transpile: [/typed-vuex/], - }, } diff --git a/packages/nuxt-typed-vuex/src/index.ts b/packages/nuxt-typed-vuex/src/index.ts index 2fc9d33..db331d6 100644 --- a/packages/nuxt-typed-vuex/src/index.ts +++ b/packages/nuxt-typed-vuex/src/index.ts @@ -15,6 +15,9 @@ const nuxtTypedVuex: Module = async function() { store: normalize(path.join(buildDir, 'store')), }, }) + + this.options.build.transpile = /* istanbul ignore next */ this.options.build.transpile || [] + this.options.build.transpile.push(/typed-vuex/) } ;(nuxtTypedVuex as any).meta = { name: 'nuxt-typed-vuex' }