Skip to content
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

npm version seems to compiled incorrectly (or: missing dependencies) #65

Open
Dachaz opened this issue Dec 19, 2016 · 6 comments
Open

Comments

@Dachaz
Copy link

Dachaz commented Dec 19, 2016

Hello there,

I tried using npm version of bootstrap-sweetalert (1.0.1), but when I require() it I get the following:

Error: Cannot find module './handle-dom' from '/tmp/node_modules/bootstrap-sweetalert/dist'
    at /tmp/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
    at load (/tmp/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex (/tmp/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at /tmp/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

On the other hand, if I go with "vanilla" sweetalert, I get no such issue.

Any ideas?

@alekitto
Copy link
Collaborator

I don't think you can simply require the compiled dist file.
Have you tried to import (ES6 style) the dev/sweetalert.es6.js file?

@Dachaz
Copy link
Author

Dachaz commented Dec 20, 2016

That was not per choice, I just did require('bootstrap-sweetalert'), and I guess that package.json told it to go for the dist version.

Anyway, I later found sweetalert2 which both works and has the features I need, so you can decide if this ticket is still relevant or not.

@alekitto
Copy link
Collaborator

Could be relevant as it means supporting another way to include this library into a project.
Could you please post an example in which you require the library (or better a gist of the entire page requiring it)?

@CesarLanderos
Copy link

CesarLanderos commented Jan 27, 2017

i use webpack and babel, and doing a import swal from 'bootstrap-sweetalert' grabs it from the dist folder, i exclude the node_modules from being parsed by babel for performance reasons and also because is the recommended way to configure webpack, making the assumption that the modules export a es5 compatible script.

@CesarLanderos
Copy link

for me the module works fine using the dist file, but every time webpack finishes the compilation, this message shows on the console:

screen shot 2017-01-26 at 8 20 43 pm

@pwqw
Copy link

pwqw commented Mar 12, 2017

I tried to import {SweetAlert} from "bootstrap-sweetalert/dev/sweetalert.es6" and got the following error:

[16:18:28] gulp-notify: [Compile Error] SyntaxError: Unexpected token (9:7) while parsing [PROJECT_DIR]/node_modules/bootstrap-sweetalert/dev/sweetalert.es6.js while parsing file: [PROJECT_DIR]/node_modules/bootstrap-sweetalert/dev/sweetalert.es6.js

The es6 file contains:

// [...]
import {
  hasClass, addClass, removeClass,    // and this is the line 9: column 7
  escapeHtml,
  _show, show, _hide, hide,
  isDescendant,
  getTopMargin,
  fadeIn, fadeOut,
  fireClick,
  stopEventPropagation
} from './modules/handle-dom';
// [...]

I'm using browserify and babel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants