question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: build this with webpack/es6

See original GitHub issue

Hi, i use webpack as build system. But unable to build this plugin

My code

import jQuery from 'jquery'
import Inputmask from 'jquery.inputmask'

let im = new Inputmask(maskOpts)
im.mask(inputElementRef)

But always fail on client-side with error: “this.each is not a function” $.fn.inputmask.$.fn.inputmask @ jquery.inputmask.js:52

Im not familiar with AMD loader. it posible build this with webpack?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:21 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
ksrbcommented, Jun 28, 2016

@whooehoo a month late but if you are still trying to get jquery.inputmask to work with webpack here’s a ‘basic’ gist that works.

2reactions
nathanmarkscommented, Dec 2, 2015

@RobinHerbots @Bogdaan

Not sure if this is your problem bogdaan as I’m not trying the jquery implementation. Are you loading the dependency lib?

Here’s how i just set things up with jqlite

Import in your app like so:

import InputMask from 'inputmask';

to make the module available by that name you have to alias it and the dep lib

webpack config (using the jqlite dep lib, swap this out for jquery if you use that instead):

{
  // ... your config +
  resolve: {
    alias: {
      'inputmask.dependencyLib': path.join(__dirname, 'node_modules/jquery.inputmask/extra/dependencyLibs/inputmask.dependencyLib.jqlite.js'),
      'inputmask': path.join(__dirname, 'node_modules/jquery.inputmask/dist/inputmask/inputmask.js')
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting Up Webpack - ECMAScript 6 Tutorial
Step 1: Set Up Webpack · On the command line, make sure you are in the es6-tutorial directory and install the babel-loader and...
Read more >
How can I use ES6 in webpack.config.js?
Try naming your config as webpack.config.babel.js . You should have babel-register included in the project. Example at react-router-bootstrap.
Read more >
Writing client-side ES6 with webpack
webpack is a client-side module builder and module loader. This blog post shows you how to write ECMAScript 6 code with it.
Read more >
Building modular javascript applications in ES6 with React, ...
Luckily for us Webpack allows requiring pretty much any types of files using loaders. Idea behind loaders is pretty simple — they are...
Read more >
Tree Shaking
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found