ankurk91 / vue-trumbowyg

Vue.js component for Trumbowyg WYSIWYG editor :memo:
https://ankurk91.github.io/vue-trumbowyg/
MIT License
236 stars 35 forks source link

jQuery is not defined #25

Closed felixfrtz closed 5 years ago

felixfrtz commented 5 years ago

Hi,

eventhough I am importing jQuery, I am getting "jQuery is not defined":

import jQuery from 'jquery';
import Trumbowyg from 'vue-trumbowyg';  
import 'trumbowyg/dist/ui/trumbowyg.css';

Is there something wrong with how I import it?

ankurk91 commented 5 years ago

Did you followed https://github.com/ankurk91/vue-trumbowyg/wiki/Webpack

felixfrtz commented 5 years ago

Thanks. Works now. Maybe consider adding some more info on the readme.

firmanjabar commented 5 years ago

Did you followed https://github.com/ankurk91/vue-trumbowyg/wiki/Webpack

where i can find webpack.config.js?

2019-10-09

i just found 72 result in package-lock.json, but dont know how to and where i can paste this code:

module.exports = {
 // your existing config may go here
module: {
    rules: [
      {
        test: /\.(woff|woff2|eot|ttf|svg)(\?.*$|$)/,
        loader: 'file-loader?name=[name].[ext]?[hash]',
      }

    ]
},
  plugins: [
    new webpack.ProvidePlugin({
       Vue: ['vue/dist/vue.esm.js', 'default'],
      jQuery: 'jquery',
      $: 'jquery',
      'window.jQuery': 'jquery',
    }),
  ],
};

2019-10-09 (1)

firmanjabar commented 5 years ago

Did you followed https://github.com/ankurk91/vue-trumbowyg/wiki/Webpack

where i can find webpack.config.js?

Problem Solved, just adding vue.config.js on root then write the plugin:

var webpack = require("webpack");

module.exports = {
    configureWebpack: {
        plugins: [
            new webpack.ProvidePlugin({
                $: 'jquery',
                jquery: 'jquery',
                'window.jQuery': 'jquery',
                jQuery: 'jquery'
            })
        ]
    }
}