lajosbencz / vue-wamp

AutobahnJS wrapper library fo Vue.js
MIT License
48 stars 13 forks source link

[TODO] Fix bundling #20

Closed lajosbencz closed 4 years ago

lajosbencz commented 5 years ago

When installing through npm, the default browser build gets imported.

Resulting error:

./_descriptors in ./node_modules/vue-wamp/dist/vue-wamp.js
./_export in ./node_modules/vue-wamp/dist/vue-wamp.js
./_object-assign in ./node_modules/vue-wamp/dist/vue-wamp.js
./_object-dp in ./node_modules/vue-wamp/dist/vue-wamp.js

Solution: Properly configure rollup

lajosbencz commented 5 years ago

For now, the solution for me is to include the node_modules/vue-wamp folder in the webpack babel configuration:

      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [
          resolve('src'),
          resolve('test'),
          // include vue-wamp for transpilation:
          resolve('node_modules/vue-wamp'),
        ]
      },
awulkan commented 5 years ago

For now, the solution for me is to include the node_modules/vue-wamp folder in the webpack babel configuration:

      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [
          resolve('src'),
          resolve('test'),
          // include vue-wamp for transpilation:
          resolve('node_modules/vue-wamp'),
        ]
      },

@lajosbencz Where exactly did you add that? If I understand it correctly you configure Webpack stuff through the vue.config.js file. Do you have an example with all the code necessary for me to implement it?

Thanks.

asalisaf commented 5 years ago

Hey @awulkan There is bundling issue as @lajosbencz mentioned and should be fixed. Permanently you can use one of these solutions:

For ES6 or Typescript:

import VueWamp from 'vue-wamp/dist/vue-wamp.esm'

For CommonJS:

VueWamp = require( 'vue-wamp/dist/vue-wamp.cjs')

TheDuckman commented 5 years ago

import VueWamp from 'vue-wamp/dist/vue-wamp.esm'

Worked for me

lajosbencz commented 4 years ago

Since v3.x, no bundling is provided. It is up to the consumer to transpile the code.