jQuery-QueryBuilder icon indicating copy to clipboard operation
jQuery-QueryBuilder copied to clipboard

Using locale (i18n) in node enviroment.

Open mhrabiee opened this issue 4 years ago • 1 comments

Hi, I'm using the npm version of library and noticed when i import the locale into my base file (app.js for example) it throws an error.

Example File:

import 'jQuery-QueryBuilder/dist/css/query-builder.default.css';
import 'jQuery-QueryBuilder/dist/js/query-builder.standalone';
import 'jQuery-QueryBuilder/dist/i18n/query-builder.fa-IR';

Error

Module not found: Error: Can't resolve 'query-builder' 

Possible Fix I fix the issue with import query-builder into locale file.

import 'jQuery-QueryBuilder/dist/js/query-builder'

(function(root, factory) {
    if (typeof define == 'function' && define.amd) {
        define(['jquery', 'query-builder'], factory);
    }
    else {
        factory(root.jQuery);
    }
}(this, function($) {
"use strict";

var QueryBuilder = $.fn.queryBuilder;
...

Any idea?

mhrabiee avatar Aug 11 '19 07:08 mhrabiee

sorry for late reply,

you need to set alias to "jQuery-QueryBuilder" on the webpack config. e.g.

{
  resolve: {
     alias: {
        "query-builder": "jQuery-QueryBuilder"
     }
  }
}

tlyau62 avatar Aug 18 '21 02:08 tlyau62