Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Package is not defined" if 'meteor-client' not imported separately to each file in Vue project #11

Open
gustojs opened this issue Mar 26, 2017 · 1 comment

Comments

@gustojs
Copy link

gustojs commented Mar 26, 2017

I know you're more into Angular and React, but can you think of any potential reason that this error...

Uncaught ReferenceError: Package is not defined

...would show up if I don't add:

import 'meteor-client'

before other Meteor-related imports in all files?

I already imported 'meteor-client' in my main JS file. The code is working as long as I have the same line repeated in all other files that try to use Meteor. But I see you don't do it with React, so I guess it should work without it.

Error shows up both when I use special .vue files syntax and pure JS files.

My configs:

  externals: function (context, request, callback) {
    var match = request.match(/^meteor\/(.+)$/);
    var pack = match && match[1];
    var locator = pack && 'Package["' + pack + '"]';
    return locator ? callback(null, locator) : callback();
  },
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
      '@': resolve('src'),
      api: resolve('api/server')
    }
  },

package.json:

(scripts)
    "api": "cd api && meteor run --port=8000",
    "bundle-meteor-client": "meteor-client bundle -s api --url=localhost:8000"
(...)
(dev dependencies)
    "meteor-client-bundler": "^0.1.1"

meteor-client.config.json:

{
  "import": [
    "meteor-base",
    "accounts-password"
  ]
}
@gustojs gustojs changed the title "Package is not defined" if 'meteor-client' not imported separately to each .vue file "Package is not defined" if 'meteor-client' not imported separately to each file in Vue project Mar 26, 2017
@funkyLover
Copy link

@gustojs ,same problem with you. but i find that import inside the App.vue juse do the trick.
checkout here

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

No branches or pull requests

2 participants