Code Monkey home page Code Monkey logo

Comments (12)

ghettovoice avatar ghettovoice commented on May 14, 2024

Can you show me code of TpMap component? Then I'll try to reproduce the issue

from vuelayers.

nPaul avatar nPaul commented on May 14, 2024

I'am sorry
Styles of component work fine
I forgot include main.css with rails helper stylesheet_pack_tag

<%= javascript_pack_tag 'main', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'main', 'data-turbolinks-track': 'reload' %>

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

Ok, that's fine.
Take a note that recommended way to switch Vue build version is define alias through webpack config:

module.exports = {
  ...
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
    },
  },
  ...
}

Then all code that imports Vue will use the same build version.

from vuelayers.

zakst avatar zakst commented on May 14, 2024

Hi,

I thought i will write here as i am getting the same error instead of starting a new issue.

I am getting the same error.

All i added is the following

appEntry.js

import VueLayers  from 'vuelayers'
import 'vuelayers/lib/style.css'
Vue.use(VueLayers);

Component.js
Add the following three properties in data() {return...}

      center: [0, 0],
      zoom: 3,
      rotation: 0,

Componment.pug

vl-map(:load-tiles-while-animating='true', :load-tiles-while-interacting='true', style='height: 400px')
  vl-view(:center.sync='center', :zoom.sync='zoom', :rotation.sync='rotation')
  vl-layer-tile
    vl-source-osm

am i missing anything?

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

Hi, @zakst ! Your code looks right. Are you building rails app with webpacker?
And can you show me your webpack config? Or may be you have test repository that reproduce the issue

from vuelayers.

zakst avatar zakst commented on May 14, 2024

Hello @ghettovoice

I am building a nodejs app and below is the webpack.config.js

I also tried adding the following in the webpack.config.js

  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
    },
  },
const path = require('path');
const webpack = require('webpack');

const ExtractTextPlugin = require('extract-text-webpack-plugin');
const nodeEnv = process.env.NODE_ENV || 'development';
const isProduction = nodeEnv === 'production';
const LiveReloadPlugin = require('webpack-livereload-plugin');

module.exports = {

  context: path.resolve(__dirname, './src'),
  watch: true,
  entry: {
    app: './app.js',
    bsjs: './mdb/js/bootstrap.js',
    vendor: './mdb/sass/mdb.scss',
    bootstrap: './mdb/css/bootstrap.css',
    mdb: './mdb/css/mdb.css'
  },
  output: {
    path: path.resolve(__dirname, './public/assets'),
    filename: '[name].bundle.js',
    publicPath: '/assets/',
  },

  devServer: {
    contentBase: path.resolve(__dirname, './src'),
    historyApiFallback: true,
    port: 3000,
    compress: isProduction,
    inline: !isProduction,
    hot: !isProduction,
    host: '0.0.0.0',
    stats: {
      assets: true,
      children: false,
      chunks: false,
      hash: false,
      modules: false,
      publicPath: false,
      timings: true,
      version: false,
      warnings: true,
      colors: {
        green: '\u001b[32m',
      },
    },
  },
  devtool: 'source-map',
  plugins: [
    new ExtractTextPlugin({
      filename: '[name].bundle.css',
      allChunks: true,
    }),

  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: [/node_modules/],
        use: [{
          loader: 'babel-loader',
          options: {presets: ['es2015']},
        }],
      },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          use: [{
            loader: 'css-loader',
            options: {importLoaders: 1},
          }],
        }),
      },
      {
        test: /\.scss/i,
        use: ExtractTextPlugin.extract([ 'css-loader', 'sass-loader' ])
      },
      {
        test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
        use: 'url-loader?limit=20480&name=assets/[name]-[hash].[ext]',
      },
      {
        test: /\.vue$/,
        use:[{
          loader: 'vue-loader',
          options: {
            loaders: {
              js: 'babel-loader'
            }
          }
        }]
      },

    ]
  }
};

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

Hmm, config looks good. Can you make test repo with your project setup, so I can deploy it locally?

from vuelayers.

zakst avatar zakst commented on May 14, 2024

That will be great!, will do so once back to my machine.
Am i supposed to include openlayers ? I see it part of the vuelayers dependencies but just making sure that will not be the issue?

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

Yes, vuelayers depends on openlayers, it should be loaded by webpack automatically.
Ok, post link here when you will be ready

from vuelayers.

zakst avatar zakst commented on May 14, 2024

I thought of trying something out and it got rid of all the errors although the map is just not loading.

Attached is the errors that USED TO exist when i had import in my app.js once i changed it to require, the errors disappeared.

I am going to try a couple of things before creating the repo.

Problem is there is no map at all.

capture

from vuelayers.

zakst avatar zakst commented on May 14, 2024

I kept the code as is with the import as shared when i started the conversation and just deleted the node_modules and npm i and all worked fine. Have no idea where the problem was but all is good now.

Thanks @ghettovoice

from vuelayers.

ghettovoice avatar ghettovoice commented on May 14, 2024

That's good! Seems like broken npm cache or inconsistent packages versions.

from vuelayers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.