Skip to content

Commit

Permalink
fix: remove explicit dependency on vue-template-compiler (fixes #297) (
Browse files Browse the repository at this point in the history
…#305)

fix: remove explicit dependency on vue-template-compiler (fixes #297)
  • Loading branch information
paulgv committed May 13, 2019
2 parents 0fa7dc8 + 576382e commit 2eff158
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"cookie": "^0.3.1",
"js-cookie": "^2.2.0",
"vue-i18n": "^8.11.2",
"vue-i18n-extensions": "^0.2.1",
"vue-template-compiler": "^2.6.10"
"vue-i18n-extensions": "^0.2.1"
},
"devDependencies": {
"@babel/runtime": "7.4.4",
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const { COMPONENT_OPTIONS_KEY } = require('./constants')

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

exports.extractComponentOptions = (path) => {
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ module.exports = function (userOptions) {
// Generate localized routes
const pagesDir = this.options.dir && this.options.dir.pages ? this.options.dir.pages : 'pages'
this.extendRoutes((routes) => {
// This import (or more specifically 'vue-template-compiler' in helpers/components.js) needs to
// be required only at build time to avoid problems when 'vue-template-compiler' dependency is
// not available (at runtime, when using nuxt-start).
const { makeRoutes } = require('./helpers/routes')

const localizedRoutes = makeRoutes(routes, {
Expand Down

0 comments on commit 2eff158

Please sign in to comment.