Skip to content

Commit 2eff158

Browse files
authored
fix: remove explicit dependency on vue-template-compiler (fixes #297) (#305)
fix: remove explicit dependency on vue-template-compiler (fixes #297)
2 parents 0fa7dc8 + 576382e commit 2eff158

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
"cookie": "^0.3.1",
4949
"js-cookie": "^2.2.0",
5050
"vue-i18n": "^8.11.2",
51-
"vue-i18n-extensions": "^0.2.1",
52-
"vue-template-compiler": "^2.6.10"
51+
"vue-i18n-extensions": "^0.2.1"
5352
},
5453
"devDependencies": {
5554
"@babel/runtime": "7.4.4",

src/helpers/components.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ const { COMPONENT_OPTIONS_KEY } = require('./constants')
33

44
const acorn = require('acorn')
55
const walker = require('acorn-walk')
6+
// Must not be an explicit dependency to avoid version mismatch issue.
7+
// See https://github.com/nuxt-community/nuxt-i18n/issues/297
68
const compiler = require('vue-template-compiler')
79

810
exports.extractComponentOptions = (path) => {

src/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ module.exports = function (userOptions) {
5959
// Generate localized routes
6060
const pagesDir = this.options.dir && this.options.dir.pages ? this.options.dir.pages : 'pages'
6161
this.extendRoutes((routes) => {
62+
// This import (or more specifically 'vue-template-compiler' in helpers/components.js) needs to
63+
// be required only at build time to avoid problems when 'vue-template-compiler' dependency is
64+
// not available (at runtime, when using nuxt-start).
6265
const { makeRoutes } = require('./helpers/routes')
6366

6467
const localizedRoutes = makeRoutes(routes, {

0 commit comments

Comments
 (0)