Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

vue-cli-plugin-i18n should not rely on vue.config.js #57

Open
idoub opened this issue Aug 5, 2019 · 1 comment
Open

vue-cli-plugin-i18n should not rely on vue.config.js #57

idoub opened this issue Aug 5, 2019 · 1 comment

Comments

@idoub
Copy link

idoub commented Aug 5, 2019

Description of Problem

If vue-clie-plugin-i18n is installed and you move all of your configuration to package.json, the following error is thrown when you run vue ui.

(node:10494) UnhandledPromiseRejectionWarning: Error: Cannot find module '/apps/vue-sr-interview/vue.config'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at api.onPluginReload.project (/apps/vue-sr-interview/node_modules/vue-cli-plugin-i18n/ui.js:111:25)
    at fns.forEach.fn (/Users/idoub/.nvm/versions/node/v10.15.3/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/
plugins.js:282:21)
    at Array.forEach (<anonymous>)
    at callHook (/Users/idoub/.nvm/versions/node/v10.15.3/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/plugin
s.js:282:7)
    at Timeout.setTimeout [as _onTimeout] (/Users/idoub/.nvm/versions/node/v10.15.3/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apoll
o-server/connectors/plugins.js:212:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:10494) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async func
tion without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10494) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handl
ed will terminate the Node.js process with a non-zero exit code.

From the documentation, the "vue" field in package.json is valid configuration.

Steps to Reproduce

  1. Create a new simple vue-cli project.
  2. Open vue ui, install and configure vue-clie-plugin-i18n.
  3. Delete vue.config.js and add the following to package.json
  "vue": {
    "i18n": {
      "locale": "en",
      "fallbackLocale": "en",
      "localeDir": "locales",
      "enableInSFC": false
    }
  }
  1. Restart vue ui and go to "Plugins". Error will print to console and page will fail to load.

Temporary Fix

Add a blank vue.config.js file (it does not need any content).

@gregveres
Copy link

When I try to follow your directions, I get a different error:
" ERROR Invalid options in "vue" field in package.json: "i18n" is not allowed"

Ah, I see, i18n needs to be inside pluginOptions...

 "vue": {
   "pluginOptions": {
       "i18n": {
         "locale": "en",
         "fallbackLocale": "en",
         "localeDir": "locales",
         "enableInSFC": false
      }
    }
  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants