-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't seem to support Webpack #199
Comments
In the same boat too! Webpack :( |
Personally, I have set it up in the
And then in my code simply:
So, this is essentially what you are already doing, just that you can instead set it up once and then import the usual way. |
In theory it should work - the production build uses Universal Module Definition (UMD) and has the Anyone wants to investigate why it doesn't actually work and create a PR that fixes this issue? |
Can you check if beta version ( |
Yes, now I can use |
@szh Thanks for the info! It sucks that ES6 import doesn't work. I don't think that UMD is supposed to support ES6 export/import :/ I'll see if I have to provide 2 different builds - ES6 (that uses If anyone knows anything about it already, it would be awesome! |
I just tried |
@szh I still want to try it out and fix it (or at least document it) before releasing 1.6.0 (or 2.0.0, because I'm also considering removing Bower support). I've noticed that I'm exporting |
So both However, I had to add Once I installed and added that I was good to go. |
Uh, I forgot about |
Any luck figure out what type of builds you have to support to allow We're struggling with that internally as well. |
Nope, not yet :/ |
I've just published a new beta version ( I rewrote the build script completely to use gulp and rollup and it generates 3 builds now - umd for webpack 1.x, <script> tags etc., minified version of umd and es6 build for webpack 2.x, rollup etc. Let me know if it works. |
It works! Visual Studio 2015 doesn't seem to like it, but it does work fine. |
@szh What does exactly Visual Studio 2015 doesn't like about it? Maybe we can do something about it. |
@szh Are you sure you have it in package.json dependencies or devDependencies? BTW. Do you have to use |
I double checked, I do have it in package.json in dependencies: Also, before I only tested that it would transpile (I'm using TypeScript) w/o errors or warnings. I just tested a page which uses the component and I see that, whereas when using |
@szh And what happens if instead of |
Sorry I wasn't so clear. That's what I'm doing now, and it compiles to |
@szh I'm lost. Does it work with |
Both of those fail. The only thing that works is |
This will never end 😉 @szh Which version of webpack are you using? I thought I tried it with the latest webpack 1.x (though I was using my local version of this library via |
I'm using Webpack 1.14.0 |
@szh It works fine for me 😕 I created a repo with the app I'm using to test it: https://github.com/szimek/signature_pad-webpack-1-test. It's basically the demo app, just with webpack 1.14.0. Run:
to try it out. |
I was able to reproduce the issue in your demo repo by using TypeScript... |
@szh Could you make a PR to this repo I created that adds typescript and causes this error to show up? |
@szh This is probably the issue you're having: microsoft/TypeScript#13017 and rollup/rollup#1156. |
Aha. Good job tracking that down |
Looks like it might get solved soon :/ The fastest fix would probably be to switch to webpack 2.x and use the es6 version of the library ;) |
I think until it's fixed I'll continue using |
I'll probably release |
Sounds good to me! Thanks for the help! |
I'm unable to import signature_pad with the syntax |
@dlombardi Could you create a new issue? Which version are you using? |
I had this issue and what worked for me was directly importing the JS file as per this comment. I'm on webpack 2.2.1. |
Same here... cannot import / require with webpack! |
@divdax Are you using JS or TS? Which version of webpack? I've just created a very simple "app" that is bundled with webpack (3.11.0) and it works:
module.exports = {
entry: './index.js',
output: { filename: 'bundle.js' }
};
import SignaturePad from 'signature_pad';
const signaturePad = new SignaturePad(document.querySelector('canvas'));
<html>
<body>
<canvas style="border: 2px solid #000"></canvas>
<script src="bundle.js"></script>
</body>
</html> If you run If anyone still has some problems with webpack, please open a new issue. |
Could not get any variation of Webpack 3.5 w/ SignaturePad 2.3.2. |
@calvinfroedge Could you try version |
I am in the same boat, is 3.0.0-beta.1 yarn add-able? |
I don't mean to re-open this issue, but I too ran into this while migrating an application that uses signature_pad to webpack. The issue turned out to be a problem in the application code, not webpack or some interaction between webpack and signature_pad. Specifically a missing variable assignment keyword (var, let, const), which produced an error similar to the one @dlombardi had.
So if you're new to ES6 and Webpack, don't forget about little things like this and maybe consider using a javascript linter to help spot similar issues. |
I'm using Webpack to bundle my app and I'm trying to integrate SignaturePad. I tried using
import { SignaturePad } from "signature_pad"
,import "signature_pad"
,require("signature_pad")
and many other variations, with "signature_pad/signature_pad", and even "signature_pad/src/signature_pad", but it seems that Webpack doesn't support the module types that SignaturePad uses.The only way I got it to work is using exports-loader:
var SignaturePad = require("exports?SignaturePad!signature_pad/src/signature_pad");
Any plans to add Webpack support? Or am I missing something?
The text was updated successfully, but these errors were encountered: